InformationItem Class Reference
#include <InformationItem.h>
List of all members.
Constructor & Destructor Documentation
InformationItem::InformationItem |
( |
|
) |
|
The Publish Subscribe Information Item class source
00022 {
00023 pop=1;
00024 }
InformationItem::InformationItem |
( |
string |
prefix, |
|
|
char * |
id | |
|
) |
| | |
00027 {
00028 int chk=prefix.length()%PURSUIT_ID_LEN;
00029 if(strlen(id)==PURSUIT_ID_LEN && chk==0) {
00030 for(int i=0;i<PURSUIT_ID_LEN+1;i++)
00031 ID[i]=id[i];
00032 scope=prefix;
00033 }
00034 else {
00035 opp_error("Information item creation failed because of invalid ID or scope size");
00036 return;
00037 }
00038 pop=1;
00039 }
InformationItem::InformationItem |
( |
string |
id |
) |
|
00042 {
00043 scope=II.scope;
00044 for(uint i=0;i<sizeof(II.ID);i++)
00045 ID[i]=II.ID[i];
00046 pop=1;
00047 }
InformationItem::~InformationItem |
( |
|
) |
|
Member Function Documentation
virtual char* InformationItem::getID |
( |
|
) |
[inline, virtual] |
virtual double InformationItem::getPop |
( |
|
) |
[inline, virtual] |
virtual string InformationItem::getScope |
( |
|
) |
[inline, virtual] |
std::string InformationItem::info |
( |
|
) |
const [virtual] |
00102 {
00103 std::stringstream out;
00104 string temp=ID;
00105 out << "Scope:";
00106 for(uint i=0;i<scope.length();i++)
00107 out << " 0x" << chararray_to_hex(scope.substr(i,1));
00108 out << endl << "ID:";
00109 for(uint i=0;i<temp.length();i++)
00110 out << " 0x" << chararray_to_hex(temp.substr(i,1)) << " ";
00111
00112 return out.str();
00113 }
00125 {
00126 std::string fullID(II1->scope);
00127 std::string fullItemID(II2->scope);
00128 fullID.append(II1->ID,sizeof(II1->ID));
00129 fullItemID.append(II2->ID,sizeof(II2->ID));
00130 return (fullID.compare(fullItemID) < 0);
00131 }
00091 {
00092 std::string fullID(scope);
00093 std::string fullItemID(II->scope);
00094 fullID.append(ID,sizeof(ID));
00095 fullItemID.append(II->ID,sizeof(II->ID));
00096 return (fullID.compare(fullItemID) < 0);
00097 }
00113 {
00114 std::string fullID(scope);
00115 std::string fullItemID(II.scope);
00116 fullID.append(ID,sizeof(ID));
00117 fullItemID.append(II.ID,sizeof(II.ID));
00118 return (fullID.compare(fullItemID) == 0);
00119 }
00102 {
00103 std::string fullID(scope);
00104 std::string fullItemID(II->scope);
00105 fullID.append(ID,sizeof(ID));
00106 fullItemID.append(II->ID,sizeof(II->ID));
00107 return (fullID.compare(fullItemID) == 0);
00108 }
virtual int InformationItem::scopeSize |
( |
|
) |
[inline, virtual] |
void InformationItem::setID |
( |
const char * |
id |
) |
[virtual] |
00076 {
00077 if(strlen(id)==PURSUIT_ID_LEN) {
00078 for(int i=0;i<PURSUIT_ID_LEN+1;i++)
00079 ID[i]=id[i];
00080 }
00081 else {
00082 opp_error("Setting ID of information item failed because of invalid ID");
00083 return;
00084 }
00085 }
bool InformationItem::setPop |
( |
double |
p |
) |
[virtual] |
00088 {
00089
00090 if(0<p && 1>p) {
00091 pop=p;
00092 return true;
00093 }
00094 else
00095 pop=0;
00096
00097 return false;
00098 }
void InformationItem::setScope |
( |
string |
input |
) |
[virtual] |
00064 {
00065 int chk=prefix.length()%PURSUIT_ID_LEN;
00066 if(chk==0) {
00067 scope=prefix;
00068 }
00069 else {
00070 opp_error("Information item creation failed because of invalid scope size");
00071 return;
00072 }
00073 }
std::string InformationItem::toString |
( |
|
) |
[virtual] |
00116 {
00117 string out=scope+ID;
00118 return out;
00119 }
Member Data Documentation
The Item ID of the Information Item.
The popularity of the Information Item.
The scope ID of the Information Item.
The documentation for this class was generated from the following files: