00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "Object.h"
00021
00022 #include <stdio.h>
00023
00029 string fbfs::Object::Obj2string(const Obj &obj) {
00030 string s;
00031 const octet_sequence &seq = obj.value;
00032 for(int i=0; i<seq.length(); i++)
00033 s += seq[i];
00034 return s;
00035 };
00036
00037
00038 fbfs::Obj *fbfs::Object::string2Obj(const string &s) {
00039 Obj *obj = new Obj();
00040 obj->value = octet_sequence( s.length(), s.length(), (CORBA::Octet *) s.c_str() );
00041 return obj;
00042 };
00043
00044 string fbfs::Object::Obj_prop2string(const Obj_prop &obj) {
00045 char buf[64];
00046 sprintf(buf, "%d:%d:%d", obj.type, obj.value_a, obj.value_b);
00047 return string(buf);
00048 };
00049
00050 fbfs::Obj_prop fbfs::Object::string2Obj_prop(const string &s) {
00051 const char * cs = s.c_str();
00052 Obj_prop obj;
00053 sscanf(cs, "%d:%d:%d", &obj.type, &obj.value_a, &obj.value_b);
00054 return obj;
00055 };
00056
00057 string fbfs::Object::Obj_id2string(const Obj_id &obj) {
00058 string s(obj.name);
00059 return s;
00060 };
00061
00062 fbfs::Obj_id fbfs::Object::string2Obj_id(const string &s) {
00063 Obj_id obj;
00064 obj.name = (const char *) s.c_str();
00065 return obj;
00066 };
00067
00068 string fbfs::Object::Obj_ts2string(const Obj_ts &obj) {
00069 char buf[32];
00070 sprintf(buf, "%d", obj.time);
00071 return string(buf);
00072 };
00073
00074 fbfs::Obj_ts fbfs::Object::string2Obj_ts(const string &s) {
00075 const char * cs = s.c_str();
00076 Obj_ts obj;
00077 sscanf(cs, "%d", &obj.time);
00078 return obj;
00079 };
00080
00081 bool fbfs::Object::cmp_ts( const Obj_ts &uno, const Obj_ts &due) {
00082 return uno.time == due.time;
00083 };