00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <vos/corelibs/vos/vos.hh>
00014 #include <vos/metaobjects/property/property.hh>
00015
00016 void listTypes(Vobject* vob);
00017
00018 int main(int argc, char** argv)
00019 {
00020 cout << "VOS Tutorial 5 Client\n\n";
00021
00022 LocalSocketSite localsite(&NoAccessControl::static_);
00023 localsite.setTimeoutOnSelect(-1);
00024
00025 string siteurl;
00026 if(argc > 1) siteurl = argv[1];
00027 else siteurl = "vop://localhost:4231";
00028
00029 Property::registerExtenders();
00030
00031
00032
00033
00034
00035
00036 try {
00037 vRef<Vobject> position = Vobject::findObjectFromRoot(siteurl + "/planet/position");
00038
00039 listTypes(&position);
00040
00041 Property* positionproperty = MetaObject::meta_cast<Property*>(&position);
00042
00043 cout << "vostut5client: The property value of " << positionproperty->getURL().getString()
00044 << " is now " << positionproperty->read() << endl;
00045
00046 } catch(runtime_error& e) {
00047 cout << "Error! " << e.what() << "\n";
00048 }
00049 }
00050
00051 void listTypes(Vobject* vob)
00052 {
00053
00054
00055
00056 const Vobject::TypeSet& types = vob->getTypes();
00057
00058 cout << "Types for " << vob->getURL().getString() << ": ";
00059 for(Vobject::TypeSet::const_iterator i = types.begin(); i != types.end(); i++)
00060 {
00061 if(i != types.begin()) cout << ", ";
00062 cout << (*i);
00063 }
00064 cout << "\n";
00065 }
00066