| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

OnXSvc::Type< Object > Class Template Reference

#include <Type.h>

Collaboration diagram for OnXSvc::Type< Object >:

[legend]
List of all members.

Public Member Functions

virtual void * cast (const std::string &aClass) const
virtual std::string name () const
virtual Lib::IIterator * iterator ()
virtual void setIterator (Lib::IIterator *aIterator)
virtual void beginVisualize ()
virtual void endVisualize ()
 Type (const CLID &aCLID, const std::string &aType, const std::string &aLocation, IUserInterfaceSvc *aUISvc, ISoConversionSvc *aSoCnvSvc, IDataProviderSvc *aDataProviderSvc)
virtual ~Type ()
void setLocation (const std::string &aLocation)
const std::string & location () const

Protected Member Functions

bool setLocationFromSession (bool verbose=true)
bool attribute (const std::string &aWhat, std::string &aValue) const
bool attribute (const std::string &aWhat, float &aR, float &aG, float &aB) const
bool modelingSolid () const

Protected Attributes

SoRegion * fSoRegion
IUserInterfaceSvcfUISvc
ISoConversionSvcfSoCnvSvc
IDataProviderSvcfDataProviderSvc

Private Types

typedef ObjectVector< Object > Collection

Private Attributes

const CLIDfCLID
std::string fType
std::string fLocation
Lib::IIterator * fIterator
IConverterfConverter

Detailed Description

template<class Object>
class OnXSvc::Type< Object >

Definition at line 53 of file Type.h.


Member Typedef Documentation

template<class Object>
typedef ObjectVector<Object> OnXSvc::Type< Object >::Collection [private]

Definition at line 55 of file Type.h.


Constructor & Destructor Documentation

template<class Object>
OnXSvc::Type< Object >::Type ( const CLID aCLID,
const std::string &  aType,
const std::string &  aLocation,
IUserInterfaceSvc aUISvc,
ISoConversionSvc aSoCnvSvc,
IDataProviderSvc aDataProviderSvc 
) [inline]

Definition at line 152 of file Type.h.

00158     :OnX::BaseType(aUISvc->printer())
00159     ,fCLID(aCLID)
00160     ,fType(aType)
00161     ,fLocation(aLocation)
00162     ,fIterator(0)
00163     ,fConverter(0)
00164     //,fCollection(0)
00165     ,fSoRegion(0)
00166     ,fUISvc(aUISvc)
00167     ,fSoCnvSvc(aSoCnvSvc)
00168     ,fDataProviderSvc(aDataProviderSvc) {
00169 
00170     if(!fUISvc) {
00171       Lib::Out out(printer());
00172       out << "OnXSvc::Type<> :"
00173           << " can't get a IUserInterfaceSvc."
00174           << Lib::endl;
00175     }
00176 
00177     //fCollection = new Collection();
00178   }

template<class Object>
virtual OnXSvc::Type< Object >::~Type (  )  [inline, virtual]

Definition at line 179 of file Type.h.

00179                   {
00180     //delete fCollection;
00181   }


Member Function Documentation

template<class Object>
virtual void* OnXSvc::Type< Object >::cast ( const std::string &  aClass  )  const [inline, virtual]

Definition at line 57 of file Type.h.

00057                                                     {
00058     //FIXME : needed with g++-3.23 so that 
00059     //        the virtuality over the safe cast works !
00060     if(aClass=="Slash::Data::IVisualizer") {
00061       return (void*)static_cast<const Slash::Data::IVisualizer*>(this);
00062     } else {
00063       return OnX::BaseType::cast(aClass);
00064     }
00065   }

template<class Object>
virtual std::string OnXSvc::Type< Object >::name (  )  const [inline, virtual]

Definition at line 66 of file Type.h.

00066 {  return fType;}

template<class Object>
virtual Lib::IIterator* OnXSvc::Type< Object >::iterator (  )  [inline, virtual]

Definition at line 67 of file Type.h.

00067                                    {
00068     if(fIterator) return fIterator;
00069     if(!fDataProviderSvc) {
00070       Lib::Out out(printer());
00071       out << "OnXSvc::Type<>::iterator :"
00072           << " no data provider found."
00073           << Lib::endl;
00074       return new Iterator< Object >();
00075     }
00076     SmartDataPtr<DataObject> smartDataObject(fDataProviderSvc,fLocation);
00077     if(smartDataObject) {}
00078     DataObject* dataObject = 0;
00079     StatusCode sc = fDataProviderSvc->retrieveObject(fLocation, dataObject);
00080     if(!sc.isSuccess()) {
00081       Lib::Out out(printer());
00082       out << "OnXSvc::Type<>::iterator :"
00083           << " retreiveObject failed."
00084           << Lib::endl;
00085       return new Iterator< Object >();
00086     }
00087     Collection* collection = dynamic_cast<Collection*>(dataObject);
00088     if(!collection) {
00089       Lib::Out out(printer());
00090       out << "OnXSvc::Type<>::iterator :"
00091           << " dynamic_cast failed."
00092           << Lib::endl;
00093       return new Iterator< Object >();
00094     }
00095     return new Iterator< Object >(collection);
00096   }

template<class Object>
virtual void OnXSvc::Type< Object >::setIterator ( Lib::IIterator *  aIterator  )  [inline, virtual]

Definition at line 97 of file Type.h.

00097 { fIterator = aIterator;}

template<class Object>
virtual void OnXSvc::Type< Object >::beginVisualize (  )  [inline, virtual]

Definition at line 99 of file Type.h.

00099                                 {
00100     if(!fUISvc) {
00101       fSoRegion = 0;
00102       return;
00103     }
00104     ISession* session = fUISvc->session();
00105     if(!session) {
00106       Lib::Out out(printer());
00107       out << "OnXSvc::Type<>::beginVisualize :"
00108           << " can't get a ISession."
00109           << Lib::endl;
00110       fSoRegion = 0;
00111       return;
00112     }
00113     fSoRegion = fUISvc->currentSoRegion();
00114   }

template<class Object>
virtual void OnXSvc::Type< Object >::endVisualize (  )  [inline, virtual]

Definition at line 115 of file Type.h.

00115                               {
00116     fSoRegion = 0;
00117   }

template<class Object>
void OnXSvc::Type< Object >::setLocation ( const std::string &  aLocation  )  [inline]

Definition at line 182 of file Type.h.

00182 { fLocation = aLocation;}

template<class Object>
const std::string& OnXSvc::Type< Object >::location (  )  const [inline]

Definition at line 183 of file Type.h.

00183 { return fLocation;}

template<class Object>
bool OnXSvc::Type< Object >::setLocationFromSession ( bool  verbose = true  )  [inline, protected]

Definition at line 185 of file Type.h.

00185                                                    {
00186     if(!fUISvc) return false;
00187     ISession* session = fUISvc->session();
00188     if(!session) return false;
00189     std::string value;
00190     if(!session->parameterValue(fType+".location",value)) {
00191       if(verbose) {
00192         Lib::Out out(printer());
00193         out << "OnXSvc::Type<" << fType << ">::setLocationFromSession :"
00194             << " Session parameter " << fType << ".location not found."
00195             << Lib::endl;
00196       }
00197       return false;
00198     }
00199     if(value=="") {
00200       if(verbose) {
00201         Lib::Out out(printer());
00202         out << "OnXSvc::Type<" << fType << ">::setLocationFromSession :"
00203             << " Session parameter " << fType << ".location empty."
00204             << Lib::endl;
00205       }
00206       return false;
00207     }
00208     if(verbose) {
00209       Lib::Out out(printer());
00210       out << "OnXSvc::Type<" << fType << ">::setLocationFromSession :"
00211           << " set location \"" << value << "\""
00212           << Lib::endl;
00213     }
00214     setLocation(value);
00215     return true;
00216   }

template<class Object>
bool OnXSvc::Type< Object >::attribute ( const std::string &  aWhat,
std::string &  aValue 
) const [inline, protected]

Definition at line 217 of file Type.h.

00217                                                                  {
00218     aValue = "";
00219     if(!fUISvc) return false;
00220     ISession* session = fUISvc->session();
00221     if(!session) return false;
00222     return session->parameterValue(aWhat,aValue);
00223   }

template<class Object>
bool OnXSvc::Type< Object >::attribute ( const std::string &  aWhat,
float &  aR,
float &  aG,
float &  aB 
) const [inline, protected]

Definition at line 224 of file Type.h.

00224                                                                              {
00225     aR = 0.5F;
00226     aG = 0.5F;
00227     aB = 0.5F;
00228     if(!fUISvc) return false;
00229     ISession* session = fUISvc->session();
00230     if(!session) return false;
00231     std::string value;
00232     if(!session->parameterValue(aWhat,value)) return false;
00233     double r,g,b;
00234     if(!Lib::smanip::torgb(value,r,g,b)) return false;
00235     aR = (float)r;
00236     aG = (float)g;
00237     aB = (float)b;
00238     return true;
00239   }

template<class Object>
bool OnXSvc::Type< Object >::modelingSolid (  )  const [inline, protected]

Definition at line 240 of file Type.h.

00240                              {
00241     if(!fUISvc) return true;
00242     ISession* session = fUISvc->session();
00243     if(!session) return true;
00244     std::string value;
00245     if(!session->parameterValue("modeling.modeling",value)) return true;
00246     return (value=="solid" ? true : false); 
00247   }


Member Data Documentation

template<class Object>
const CLID& OnXSvc::Type< Object >::fCLID [private]

Definition at line 249 of file Type.h.

template<class Object>
std::string OnXSvc::Type< Object >::fType [private]

Definition at line 250 of file Type.h.

template<class Object>
std::string OnXSvc::Type< Object >::fLocation [private]

Definition at line 251 of file Type.h.

template<class Object>
Lib::IIterator* OnXSvc::Type< Object >::fIterator [private]

Definition at line 252 of file Type.h.

template<class Object>
IConverter* OnXSvc::Type< Object >::fConverter [private]

Definition at line 253 of file Type.h.

template<class Object>
SoRegion* OnXSvc::Type< Object >::fSoRegion [protected]

Definition at line 256 of file Type.h.

template<class Object>
IUserInterfaceSvc* OnXSvc::Type< Object >::fUISvc [protected]

Definition at line 257 of file Type.h.

template<class Object>
ISoConversionSvc* OnXSvc::Type< Object >::fSoCnvSvc [protected]

Definition at line 258 of file Type.h.

template<class Object>
IDataProviderSvc* OnXSvc::Type< Object >::fDataProviderSvc [protected]

Definition at line 259 of file Type.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:02:02 2011 for OnXSvc by doxygen 1.4.7