00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 #ifndef __JAUS_CORE_DISCOVERY_SUBSYSTEM__H 00042 #define __JAUS_CORE_DISCOVERY_SUBSYSTEM__H 00043 00044 #include "jaus/core/service.h" 00045 00046 00047 namespace JAUS 00048 { 00055 class JAUS_CORE_DLL Subsystem 00056 { 00057 public: 00058 // The values for the particular unmanned vehicle (subsystem) type, node type or 00059 // component type. 00060 enum Type 00061 { 00062 Vehicle = 10001, 00063 OCU = 20001, 00064 OtherSubsystem = 30001 00065 }; 00072 class JAUS_CORE_DLL Component 00073 { 00074 public: 00075 typedef std::vector<Component> List; 00076 typedef std::set<Component> Set; 00077 Component(); 00078 Component(const Address& id); 00079 Component(const Address& id, const Service::ID::Set& services); 00080 Component(const Component& component); 00081 ~Component(); 00082 Component& operator=(const Component& component); 00083 bool operator <(const Component& component) const { return mID < component.mID; } 00084 Address mID; 00085 int mAuthorityLevel; 00086 int mStatus; 00087 std::string mIdentification; 00088 Service::ID::Set mServices; 00089 }; 00090 typedef Mutex::ScopedPtr<Subsystem> Ptr; 00091 typedef std::map<Byte, Component::Set> Configuration; 00092 typedef std::map<UShort, Subsystem *> Map; 00093 Subsystem(); 00094 Subsystem(const Subsystem& configuration); 00095 ~Subsystem(); 00096 inline bool IsVehicle() const { return (mType >= Vehicle && mType < OCU); } 00097 void AddComponent(const Address& component, const Service::ID::Set& services); 00098 void RemoveComponent(const Address& component); 00099 bool HaveService(const std::string& name, Address* id = NULL) const; 00100 bool HaveComponent(const Address& id) const; 00101 Component* GetComponent(const Address& id); 00102 const Component* GetComponent(const Address& id) const; 00103 Address::List GetComponentsWithService(const std::string& name) const; 00104 Component::List GetConfiguration() const; 00105 Address::List GetAddressList() const; 00106 virtual Subsystem* Clone() const { return new Subsystem(*this) ; } 00107 Subsystem& operator=(const Subsystem& configuration); 00108 void CopySubsystemData(const Subsystem* subsystem); 00109 static void DeleteSubsystemMap(Map& list); 00110 static void CopySubsystemMap(const Map& src, Map& dest); 00111 UShort mSubsystemID; 00112 Configuration mConfiguration; 00113 Type mType; 00114 Time mUpdateTime; 00115 std::string mIdentification; 00116 }; 00117 } 00118 00119 #endif 00120 /* End of File */