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
#ifndef Entity_CLASS
00028
#define Entity_CLASS
00029
00030
#include <iostream>
00031
#include <string>
00032
using namespace std;
00033
00034
#ifndef WITHOUT_ACS
00035
#include <asdmIDLTypesC.h>
00036
using asdmIDLTypes::IDLEntity;
00037
#endif
00038
00039
#include <EntityId.h>
00040
00041
#include <StringTokenizer.h>
00042
#include <InvalidArgumentException.h>
00043
#include <InvalidDataException.h>
00044
using asdm::StringTokenizer;
00045
using asdm::InvalidArgumentException;
00046
using asdm::InvalidDataException;
00047
00048
#include "EndianStream.h"
00049
using asdm::EndianOSStream;
00050
using asdm::EndianISStream;
00051
00052
namespace asdm {
00053
00054
class Entity;
00055 ostream & operator << ( ostream &,
const Entity & );
00056
00065 class Entity {
00066
friend ostream & operator << ( ostream &,
const Entity & );
00067
friend istream & operator >> ( istream &,
Entity&);
00068
00069
public:
00070
static Entity getEntity(
StringTokenizer &t)
throw(
InvalidArgumentException);
00071
00072
Entity();
00073
Entity(
const string &s);
00074
#ifndef WITHOUT_ACS
00075
Entity(IDLEntity &);
00076
#endif
00077
Entity(string entityId, string entityIdEncrypted, string entityTypeName,
00078 string entityVersion, string instanceVersion);
00079
virtual ~
Entity();
00080
00081
bool operator == (
const Entity &)
const;
00082
bool equals(
const Entity &)
const;
00083
bool operator != (
const Entity &)
const;
00084
00085
bool isNull()
const;
00086
00087 string toString()
const;
00088 string toXML()
const throw(
InvalidDataException);
00089
#ifndef WITHOUT_ACS
00090
IDLEntity toIDLEntity()
const;
00091
#endif
00092
void setFromXML(string xml)
throw(
InvalidArgumentException);
00093
00097
void toBin(EndianOSStream& eoss);
00098
00105
static Entity fromBin(EndianISStream& eiss);
00106
00107
EntityId getEntityId()
const;
00108 string getEntityIdEncrypted()
const;
00109 string getEntityTypeName()
const;
00110 string getEntityVersion()
const;
00111 string getInstanceVersion()
const;
00112
void setEntityId(
EntityId e);
00113
void setEntityIdEncrypted(string s);
00114
void setEntityTypeName(string s);
00115
void setEntityVersion(string s);
00116
void setInstanceVersion(string s);
00117
00118
private:
00119
EntityId entityId;
00120 string entityIdEncrypted;
00121 string entityTypeName;
00122 string entityVersion;
00123 string instanceVersion;
00124
00125 string getXMLValue(string xml, string parm)
const;
00126 string validXML()
const;
00127
00128 };
00129
00130
00131
inline Entity::Entity(
const string &s) {
00132 setFromXML(s);
00133 }
00134
00135
00136
inline Entity::~Entity() { }
00137
00138
inline bool Entity::isNull()
const {
00139
return entityId.isNull();
00140 }
00141
00142
inline string Entity::toString()
const {
00143
return toXML();
00144 }
00145
00146
inline bool Entity::equals(
const Entity &x)
const {
00147
return *
this == x;
00148 }
00149
00150
00151
00152
inline EntityId Entity::getEntityId()
const {
00153
return entityId;
00154 }
00155
00156
inline string Entity::getEntityIdEncrypted()
const {
00157
return entityIdEncrypted;
00158 }
00159
00160
inline string Entity::getEntityTypeName()
const {
00161
return entityTypeName;
00162 }
00163
00164
inline string Entity::getEntityVersion()
const {
00165
return entityVersion;
00166 }
00167
00168
inline string Entity::getInstanceVersion()
const {
00169
return instanceVersion;
00170 }
00171
00172
inline void Entity::setEntityId(EntityId e) {
00173 entityId = e;
00174 }
00175
00176
inline void Entity::setEntityIdEncrypted(string s) {
00177 entityIdEncrypted = s;
00178 }
00179
00180
inline void Entity::setEntityTypeName(string s) {
00181 entityTypeName = s;
00182 }
00183
00184
inline void Entity::setEntityVersion(string s) {
00185 entityVersion = s;
00186 }
00187
00188
inline void Entity::setInstanceVersion(string s) {
00189 instanceVersion = s;
00190 }
00191
00192
00193
00194
inline ostream & operator << ( ostream &o,
const Entity &x ) {
00195 o << x.toXML();
00196
return o;
00197 }
00198
00199 }
00200
00201
#endif