ObjectsManager.h
См. документацию.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00024
00025 #ifndef ObjectsManager_H_
00026 #define ObjectsManager_H_
00027
00028 #include <omniORB4/CORBA.h>
00029 #include "UniSetTypes.h"
00030 #include "UniSetObject.h"
00031 #include "ObjectsManager_i.hh"
00032
00033 class ObjectsActivator;
00034
00035 class ObjectsManager;
00036 typedef std::list<ObjectsManager*> ObjectsManagerList;
00037
00056 class ObjectsManager:
00057 public UniSetObject,
00058 public POA_ObjectsManager_i
00059 {
00060 public:
00061 ObjectsManager( UniSetTypes::ObjectId id);
00062 ObjectsManager( const std::string name, const std::string section );
00063 virtual ~ObjectsManager();
00064
00065
00066 virtual UniSetTypes::ObjectType getType(){ return UniSetTypes::getObjectType("ObjectsManager"); }
00067
00068
00069 virtual void broadcast(const UniSetTypes::TransportMessage& msg);
00070 virtual UniSetTypes::SimpleInfoSeq* getObjectsInfo( CORBA::Long MaxLength=300 );
00071
00072
00073 void initPOA(ObjectsManager* rmngr);
00074
00075 virtual bool addObject(UniSetObject *obj);
00076 virtual bool removeObject(UniSetObject *obj);
00077
00078 virtual bool addManager( ObjectsManager *mngr );
00079 virtual bool removeManager( ObjectsManager *mngr );
00080
00081
00085 const ObjectsManager* itemM(const UniSetTypes::ObjectId id);
00086
00087
00091 const UniSetObject* itemO( const UniSetTypes::ObjectId id );
00092
00093
00094
00095 inline ObjectsManagerList::const_iterator beginMList()
00096 {
00097 return mlist.begin();
00098 }
00099
00100 inline ObjectsManagerList::const_iterator endMList()
00101 {
00102 return mlist.end();
00103 }
00104
00105 inline ObjectsList::const_iterator beginOList()
00106 {
00107 return olist.begin();
00108 }
00109
00110 inline ObjectsList::const_iterator endOList()
00111 {
00112 return olist.end();
00113 }
00114
00115 int objectsCount();
00116
00117
00118 PortableServer::POA_ptr getPOA(){ return PortableServer::POA::_duplicate(poa); }
00119 PortableServer::POAManager_ptr getPOAManager(){ return PortableServer::POAManager::_duplicate(pman); }
00120
00121 protected:
00122
00123 ObjectsManager();
00124
00125 enum OManagerCommand{deactiv, activ, initial, term};
00126
00127
00128 void objects(OManagerCommand cmd);
00129
00130 void managers(OManagerCommand cmd);
00131
00132 virtual void sigterm( int signo );
00133
00135 virtual bool activateObject();
00137 virtual bool disactivateObject();
00138
00139
00140 typedef ObjectsManagerList::iterator MListIterator;
00141
00142 int getObjectsInfo( ObjectsManager* mngr, UniSetTypes::SimpleInfoSeq* seq,
00143 int begin, const long uplimit );
00144
00145 PortableServer::POA_var poa;
00146 PortableServer::POAManager_var pman;
00147
00148 private:
00149
00150 friend class ObjectsActivator;
00151
00152 int sig;
00153 ObjectsManagerList mlist;
00154 ObjectsList olist;
00155
00156 UniSetTypes::uniset_mutex olistMutex;
00157 UniSetTypes::uniset_mutex mlistMutex;
00158
00159 };
00160
00161 #endif