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 EntityId_CLASS
00028
#define EntityId_CLASS
00029
00030
#include <iostream>
00031
#include <string>
00032
using namespace std;
00033
00034
#ifndef WITHOUT_ACS
00035
#include <asdmIDLTypesC.h>
00036
using asdmIDLTypes::IDLEntityId;
00037
#endif
00038
00039
#include <StringTokenizer.h>
00040
#include <InvalidArgumentException.h>
00041
using asdm::StringTokenizer;
00042
using asdm::InvalidArgumentException;
00043
00044
#include "EndianStream.h"
00045
using asdm::EndianOSStream;
00046
using asdm::EndianISStream;
00047
00048
namespace asdm {
00049
00050
class EntityId;
00051 ostream & operator << ( ostream &,
const EntityId & );
00052 istream & operator >> ( istream &, EntityId&);
00053
00062 class EntityId {
00063
friend ostream & operator << ( ostream &,
const EntityId & );
00064
friend istream & operator >> ( istream &,
EntityId&);
00065
00066
public:
00067
static EntityId getEntityId(
StringTokenizer &t)
00068
throw (
InvalidArgumentException) ;
00069
static string validate(string x);
00070
00071
EntityId();
00072
EntityId(
const EntityId &);
00073
EntityId(
const string &
id)
throw (
InvalidArgumentException);
00074
#ifndef WITHOUT_ACS
00075
EntityId(IDLEntityId &)
throw (
InvalidArgumentException);
00076
#endif
00077
virtual ~
EntityId();
00078
00079
EntityId& operator = (
const EntityId &);
00080
00081
bool equals(
const EntityId &)
const;
00082
bool operator == (
const EntityId&)
const;
00083
bool operator != (
const EntityId&)
const;
00084
00085 string toString()
const;
00086
#ifndef WITHOUT_ACS
00087
IDLEntityId toIDLEntityId()
const;
00088
#endif
00089
00093
void toBin(EndianOSStream& eoss);
00094
00102
static EntityId fromBin(EndianISStream& eiss);
00103
00104
bool isNull()
const;
00105
00106 string getId()
const;
00107
void setId(string e);
00108
00109
private:
00110 string
id;
00111
00112 };
00113
00114
00115
inline EntityId::EntityId() : id(
"") { }
00116
00117
inline EntityId::EntityId(
const EntityId &t) : id(t.id) { }
00118
00119
00120
inline EntityId::~EntityId() { }
00121
00122
inline EntityId& EntityId::operator = (
const EntityId &x ) {
00123
id = x.id;
00124
return *
this;
00125 }
00126
00127
inline bool EntityId::isNull()
const {
00128
return id.length() == 0;
00129 }
00130
00131
inline bool EntityId::equals(
const EntityId &x)
const {
00132
return id == x.id;
00133 }
00134
00135
inline bool EntityId::operator == (
const EntityId &x)
const {
00136
return id == x.id;
00137 }
00138
00139
inline bool EntityId::operator != (
const EntityId &x)
const {
00140
return id != x.id;
00141 }
00142
00143
inline string EntityId::toString()
const {
00144
return id;
00145 }
00146
00147
#ifndef WITHOUT_ACS
00148
inline IDLEntityId EntityId::toIDLEntityId()
const {
00149 IDLEntityId x;
00150 x.value = CORBA::string_dup(
id.c_str());
00151
return x;
00152 }
00153
#endif
00154
00155
inline string EntityId::getId()
const {
00156
return id;
00157 }
00158
00159
inline void EntityId::setId(string s) {
00160
id = s;
00161 }
00162
00163
00164
00165
inline ostream & operator << ( ostream &o,
const EntityId &x ) {
00166 o << x.id;
00167
return o;
00168 }
00169
00170
inline istream & operator >> ( istream &i, EntityId &x ) {
00171 i >> x.id;
00172
return i;
00173 }
00174
00175 }
00176
00177
#endif