NLAIAGENT::CComponentHandle Class Reference

#include <comp_handle.h>


Public Member Functions

 CComponentHandle (const IVarName &comp_name, IAgent *comp_father, bool get=false)
 CComponentHandle ()
const IVarNamegetCompName ()
void getComponent ()
const IObjectIAgetValue ()
 ~CComponentHandle ()

Private Attributes

const IObjectIA_Comp
IAgent_CompFather
IVarName_CompName


Constructor & Destructor Documentation

NLAIAGENT::CComponentHandle::CComponentHandle  )  [inline]
 

Definition at line 46 of file comp_handle.h.

References _Comp, and _CompFather.

00047                         {
00048                                 _Comp = NULL;
00049                                 _CompFather = NULL;
00050                         }

NLAIAGENT::CComponentHandle::~CComponentHandle  )  [inline]
 

Definition at line 52 of file comp_handle.h.

References _CompName, and NLAIC::IPointerGestion::release().

00053                         {
00054                                 if(_CompName != NULL) _CompName->release();
00055 //                              if ( _Comp )
00056 //                                      _Comp->release();
00057                         }

NLAIAGENT::CComponentHandle::CComponentHandle const IVarName comp_name,
IAgent comp_father,
bool  get = false
[inline]
 

Definition at line 60 of file comp_handle.h.

References _Comp, _CompFather, _CompName, NLAIC::IBasicType::clone(), and getComponent().

00061                         {
00062                                 _CompName = (IVarName *) comp_name.clone();
00063                                 _CompFather = comp_father;
00064                                 if ( get )
00065                                         getComponent();
00066                                 else
00067                                         _Comp = NULL;
00068                         }


Member Function Documentation

const IVarName* NLAIAGENT::CComponentHandle::getCompName  )  [inline]
 

Definition at line 121 of file comp_handle.h.

References _CompName.

00122                         {
00123                                 return _CompName;
00124                         }

void NLAIAGENT::CComponentHandle::getComponent  )  [inline]
 

Definition at line 70 of file comp_handle.h.

References _Comp, _CompFather, _CompName, buffer, NLAIAGENT::IBaseGroupType::get(), NLAIC::IBasicType::getDebugString(), NLAIAGENT::IObjectIA::getStaticMember(), NLAIAGENT::IObjectIA::getStaticMemberIndex(), NLAIC::IBasicType::getType(), NLAIAGENT::IAgent::getType(), param, NLAIC::IPointerGestion::release(), NLAIAGENT::IObjectIA::CProcessResult::Result, sint32, and NLAIAGENT::IBaseGroupType::size().

Referenced by CComponentHandle(), and getValue().

00071                         {
00072                                 if ( _CompFather != NULL )
00073                                 {
00074 
00075 #ifdef _DEBUG
00076                                         const char *dbg_father_type = (const char *) _CompFather->getType();
00077                                         const char *dbg_comp_name = (const char *) _CompName->getType();
00078                                         std::string buffer;
00079                                         _CompName->getDebugString(buffer);
00080 #endif
00081 
00082                                         // Looks in static components
00083                                         sint32 comp_id = _CompFather->getStaticMemberIndex( *_CompName );
00084                                         if ( comp_id >= 0)
00085                                                 _Comp = _CompFather->getStaticMember( comp_id );
00086                                         else
00087                                                 _Comp = NULL;
00088 
00089                                         if ( _Comp == NULL )
00090                                         {
00091                                                 // Looks in dynamic component
00092                                                 CGroupType *param = new CGroupType();
00093                                                 param->push( (IObjectIA *) new CStringType(*_CompName) );
00094                                                 IObjectIA::CProcessResult comp = ( (CAgentScript *) _CompFather)->getDynamicAgent(param);
00095                                                 //param->pop();
00096                                                 delete param;
00097                                                 NLAIAGENT::IBaseGroupType *result = (NLAIAGENT::IBaseGroupType *) comp.Result;
00098                                                 if ( result->size() >  0 )
00099                                                 {
00100                                                         _Comp = result->get();
00101                                                         ((IObjectIA *)_Comp)->incRef();                                                 
00102                                                 }
00103                                                 else
00104                                                         _Comp = NULL;
00105 
00106                                                 if(result != NULL) 
00107                                                                         result->release();
00108                                         }
00109                                 }
00110                         }

const IObjectIA* NLAIAGENT::CComponentHandle::getValue  )  [inline]
 

Definition at line 112 of file comp_handle.h.

References _Comp, and getComponent().

Referenced by NLAIAGENT::COperatorScript::calcPriority().

00113                         {
00114                                 if ( _Comp )
00115                                         return _Comp;
00116                                 
00117                                 getComponent();
00118                                 return _Comp;
00119                         }


Field Documentation

const IObjectIA* NLAIAGENT::CComponentHandle::_Comp [private]
 

Definition at line 42 of file comp_handle.h.

Referenced by CComponentHandle(), getComponent(), and getValue().

IAgent* NLAIAGENT::CComponentHandle::_CompFather [private]
 

Definition at line 43 of file comp_handle.h.

Referenced by CComponentHandle(), and getComponent().

IVarName* NLAIAGENT::CComponentHandle::_CompName [private]
 

Definition at line 41 of file comp_handle.h.

Referenced by CComponentHandle(), getCompName(), getComponent(), and ~CComponentHandle().


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 09:07:43 2004 for NeL by doxygen 1.3.6