7 #ifndef ATLAS_OBJECTS_BASEOBJECT_H 8 #define ATLAS_OBJECTS_BASEOBJECT_H 10 #include <Atlas/Message/MEncoder.h> 11 #include <Atlas/Message/Element.h> 12 #include <Atlas/Bridge.h> 13 #include <Atlas/Exception.h> 103 T *getDefaultObjectInstance();
121 void free(T *instance);
130 template <
typename T>
136 template <
typename T>
141 template <
typename T>
147 template <
typename T>
152 assert( res->m_refCount == 0 );
153 res->m_attrFlags = 0;
154 res->m_attributes.clear();
161 template <
typename T>
169 template <
typename T>
176 next =
static_cast<T*
>(next->m_next);
183 static const int BASE_OBJECT_NO = 0;
237 int32_t getAttrFlags()
const 245 virtual bool instanceOf(
int classNo)
const;
248 bool hasAttr(
const std::string& name)
const;
250 bool hasAttrFlag(
int flag)
const;
257 virtual int copyAttr(
const std::string& name,
260 virtual void setAttr(
const std::string& name,
263 virtual void removeAttr(
const std::string& name);
265 virtual void removeAttrFlag(
int flag);
269 Atlas::Message::MapType asMessage()
const;
272 virtual void addToMessage(Atlas::Message::MapType &)
const;
302 iterator() : m_obj(
nullptr), m_val(
"", *
this) {}
304 m_current_class(I.m_current_class),
305 m_I(I.m_I), m_val(I.m_val.first, *
this) {}
316 bool operator==(
const iterator& I)
const;
318 bool operator!=(
const iterator& I)
const {
return !operator==(I);}
338 typedef std::pair<std::string,PsuedoElement> value_type;
340 const value_type& operator*()
const {
return m_val;}
341 const value_type* operator->()
const {
return &m_val;}
346 Message::MapType::iterator m_I;
360 m_current_class(I.m_current_class),
361 m_I(I.m_I), m_val(I.m_val.first, *
this) {}
363 m_current_class(I.m_current_class),
364 m_I(I.m_I), m_val(I.m_val.first, *
this) {}
377 bool operator!=(
const const_iterator& I)
const {
return !operator==(I);}
392 typedef std::pair<std::string,PsuedoElement> value_type;
394 const value_type& operator*()
const {
return m_val;}
395 const value_type* operator->()
const {
return &m_val;}
400 Message::MapType::const_iterator m_I;
420 virtual void free() = 0;
421 virtual void reset() = 0;
426 virtual int getAttrClass(
const std::string& name)
const;
429 virtual int getAttrFlag(
const std::string& name)
const;
432 virtual void iterate(
int& current_class, std::string& attr)
const;
446 std::map<std::string, Atlas::Message::Element> m_attributes;
451 inline void BaseObjectData::incRef() {
455 inline void BaseObjectData::decRef() {
457 assert( m_refCount >= 0 );
Allocator()
Ctor.
Definition: BaseObject.h:131
Definition: BaseObject.h:353
T m_defaults_Data
The default instance, acting as a prototype for all other instances.
Definition: BaseObject.h:68
Atlas stream bridge.
Definition: Bridge.h:35
const std::string & getName() const
Get the name of the attribute which does not exist.
Definition: BaseObject.h:43
The iterator first iterates over the contents of m_obj->m_attributes, holding an iterator to the attr...
Definition: BaseObject.h:296
void free(T *instance)
Frees up an instance.
Definition: BaseObject.h:162
BaseObjectData * m_defaults
The default instance, acting as a prototype for all other instances.
Definition: BaseObject.h:440
T * getDefaultObjectInstance()
Gets the default object instance, which acts as a prototype for all other instances in the system...
Definition: BaseObject.h:142
Multi-type container.
Definition: Element.h:60
int getClassNo() const
Get class number:
Definition: BaseObject.h:232
The Atlas namespace.
Definition: Bridge.h:20
An exception indicating the requested attribute does not exist.
Definition: BaseObject.h:32
Definition: BaseObject.h:320
void release()
Deletes all pooled but unused instances.
Definition: BaseObject.h:170
~Allocator()
Dtor.
Definition: BaseObject.h:137
T * m_begin_Data
The first available instance, not currently in use.
Definition: BaseObject.h:75
T * alloc()
Allocates a new instance to be used.
Definition: BaseObject.h:148
Definition: BaseObject.h:379
BaseObjectData * m_next
The next instance, if this instance has been freed up.
Definition: BaseObject.h:445
Trait which handles allocation of instances of BaseObject.
Definition: BaseObject.h:63
Atlas base object class.
Definition: BaseObject.h:214
Base class for all exceptions thrown by Atlas-C++.
Definition: Exception.h:17
std::map< std::string, int32_t > attr_flags_Data
A map of attributes and their flags.
Definition: BaseObject.h:82