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>
46 static const int BASE_OBJECT_NO = 0;
84 int getAttrFlags()
const
95 bool hasAttr(
const std::string& name)
const;
125 inline void incRef();
126 inline void decRef();
165 iterator() : m_obj(0), m_val(
"", *
this) {}
167 m_current_class(I.m_current_class),
168 m_I(I.m_I), m_val(I.m_val.first, *
this) {}
179 bool operator==(
const iterator& I)
const;
181 bool operator!=(
const iterator& I)
const {
return !operator==(I);}
201 typedef std::pair<std::string,PsuedoElement> value_type;
203 const value_type& operator*()
const {
return m_val;}
204 const value_type* operator->()
const {
return &m_val;}
209 Message::MapType::iterator m_I;
212 friend class iterator;
223 m_current_class(I.m_current_class),
224 m_I(I.m_I), m_val(I.m_val.first, *
this) {}
226 m_current_class(I.m_current_class),
227 m_I(I.m_I), m_val(I.m_val.first, *
this) {}
240 bool operator!=(
const const_iterator& I)
const {
return !operator==(I);}
255 typedef std::pair<std::string,PsuedoElement> value_type;
257 const value_type& operator*()
const {
return m_val;}
258 const value_type* operator->()
const {
return &m_val;}
263 Message::MapType::const_iterator m_I;
267 friend class const_iterator;
269 iterator begin() {
return iterator(*
this, -1);}
270 iterator end() {
return iterator(*
this, BASE_OBJECT_NO);}
271 iterator find(
const std::string&);
273 const_iterator begin()
const {
return const_iterator(*
this, -1);}
274 const_iterator end()
const {
return const_iterator(*
this, BASE_OBJECT_NO);}
275 const_iterator find(
const std::string&)
const;
286 virtual void iterate(
int& current_class, std::string& attr)
const;
294 std::map<std::string, Atlas::Message::Element> m_attributes;
299 void BaseObjectData::incRef() {
303 void BaseObjectData::decRef() {
305 assert( m_refCount >= 0 );
313 BaseObjectData::iterator BaseObjectData::iterator::operator++(
int)
315 iterator tmp = *
this;
320 BaseObjectData::const_iterator BaseObjectData::const_iterator::operator++(
int)
322 const_iterator tmp = *
this;
Atlas base object class.
Definition: BaseObject.h:68
virtual void setAttr(const std::string &name, const Atlas::Message::Element &attr)
Set the attribute "name" to the value given by "attr".
Atlas stream bridge.
Definition: Bridge.h:36
BaseObjectData(BaseObjectData *defaults)
Construct a new BaseObjectData from a subclass.
virtual void removeAttr(const std::string &name)
Remove the attribute "name".
Definition: BaseObject.h:184
An exception indicating the requested attribute does not exist.
Definition: BaseObject.h:33
virtual int getAttrFlag(const std::string &name) const
Find the flag for the attribute "name".
int getClassNo() const
Get class number:
Definition: BaseObject.h:79
const Atlas::Message::Element getAttr(const std::string &name) const
Retrieve the attribute "name".
Multi-type container.
Definition: Element.h:61
virtual int copyAttr(const std::string &name, Atlas::Message::Element &attr) const
Retrieve the attribute "name".
bool hasAttr(const std::string &name) const
Check whether the attribute "name" exists.
Base class for all exceptions thrown by Atlas-C++.
Definition: Exception.h:18
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
Definition: BaseObject.h:217
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
The iterator first iterates over the contents of m_obj->m_attributes, holding an iterator to the attr...
Definition: BaseObject.h:160
virtual void removeAttrFlag(int flag)
Remove the attribute "name".
The Atlas namespace.
Definition: Bridge.h:20
const Atlas::Message::MapType asMessage() const
Convert this object to a Object.
virtual int getAttrClass(const std::string &name) const
Find the class which contains the attribute "name".
bool hasAttrFlag(int flag) const
Check whether the attribute "name" exists.
virtual bool instanceOf(int classNo) const
Is this instance of some class?
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: BaseObject.h:243
const std::string & getName() const
Get the name of the attribute which does not exist.
Definition: BaseObject.h:41
static BaseObjectData * alloc()
Allocate a new instance of this class, using an existing instance if available.
Definition: BaseObject.h:133
virtual void free()=0
Free an instance of this class, returning it to the memory pool.
Copyright 2000-2004 the respective authors.
This document can be licensed under the terms of the GNU Free Documentation
License or the GNU General Public License and may be freely distributed under
the terms given by one of these licenses.