本文整理汇总了C++中Adapter类的典型用法代码示例。如果您正苦于以下问题:C++ Adapter类的具体用法?C++ Adapter怎么用?C++ Adapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Adapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enableIndications
void Adapter::enableIndications(
CMPIIndicationMI* mi,
const CMPIContext* context)
{
TRACE;
_context_tls.set((void*)context);
Adapter* adapter = (Adapter*)mi->hdl;
Auto_RMutex auto_lock(adapter->_lock);
// Ignore request if indications already enabled.
if (adapter->_indications_enabled)
return;
adapter->_indications_enabled = true;
// Invoke the provider:
Enable_Indications_Status status = adapter->enable_indications(
_indication_proc, adapter);
switch (status)
{
case ENABLE_INDICATIONS_OK:
break;
case ENABLE_INDICATIONS_FAILED:
break;
}
}
示例2: disableIndications
void Adapter::disableIndications(
CMPIIndicationMI* mi,
const CMPIContext* context)
{
TRACE;
_context_tls.set((void*)context);
Adapter* adapter = (Adapter*)mi->hdl;
Auto_RMutex auto_lock(adapter->_lock);
// Ignore if indications are not enabled.
if (!adapter->_indications_enabled)
return;
// Invoke the provider:
Disable_Indications_Status status = adapter->disable_indications();
switch (status)
{
case DISABLE_INDICATIONS_OK:
break;
case DISABLE_INDICATIONS_FAILED:
break;
}
adapter->_indications_enabled = false;
}
示例3: Adapter
Adapter *Agent::addAdapter (const string & aDeviceName,
const string & aHost,
const unsigned int aPort,
bool aStart,
int aLegacyTimeout
)
{
Adapter *adapter = new Adapter(aDeviceName, aHost, aPort, aLegacyTimeout);
adapter->setAgent(*this);
mAdapters.push_back(adapter);
Device *dev = mDeviceMap[aDeviceName];
if ( ( dev != NULL ) && dev->mAvailabilityAdded )
{
adapter->setAutoAvailable(true);
}
if ( aStart )
{
adapter->start( );
}
return adapter;
}
示例4: Adapter
void XMLConfigReader::getAdaptersFromXML(TiXmlElement* ruleEngineElm, RuleEngine *engine) {
for (TiXmlElement* adapterElm = ruleEngineElm->FirstChildElement("adapter");
adapterElm != NULL; adapterElm = adapterElm->NextSiblingElement("adapter")) {
TiXmlElement* conditionElm = adapterElm->FirstChildElement("rule");
if(conditionElm != NULL){
std::string rule = std::string(conditionElm->GetText());
int delimiterLoc = rule.find(":");
Adapter *adapter = new Adapter(new Rule(rule.substr(0, delimiterLoc),
rule.substr(delimiterLoc + 1, rule.length()).at(0)));
for (TiXmlElement* actionElm = adapterElm->FirstChildElement("action");
actionElm != NULL; actionElm = actionElm->NextSiblingElement("action")) {
std::string actionTxt = std::string(actionElm->GetText());
if(actionTxt == "ADD"){
adapter->addAction(ADD);
} else if(actionTxt == "DEL"){
adapter->addAction(DEL);
} else if(actionTxt == "MOD"){
adapter->addAction(MOD);
} else if(actionTxt == "SHF"){
adapter->addAction(SHF);
} else {
std::cerr << "Action: " << actionTxt << " not defined!!" << std::endl;
}
}
engine->addAdapter(adapter);
}
}
}
示例5: Adapter_addJoin
static void
Adapter_addJoin( Adapter adp,
ZnkStr ans, const StrListHandle str_list,
size_t begin, size_t end,
const char* connector, size_t connector_leng, size_t expect_elem_leng )
{
const size_t num = adp->size_( str_list );
end = Znk_MIN( num, end );
if( end > begin ){
size_t idx;
DECIDE_STRLENG( connector_leng, connector );
/* おおまかな予想予約サイズ */
ZnkBfr_reserve( ans, ZnkBfr_size(ans) + ( expect_elem_leng + connector_leng ) * (end-begin) );
/***
* ZnkStr_add, あるいは ZnkStr_appendで十分高速である.
* これらを使わずに工夫を凝らしたとしてもほとんど差はない.
*/
for( idx=begin; idx<end-1; ++idx ){
ZnkStr_add( ans, adp->at_( str_list, idx ) );
ZnkStr_append( ans, connector, connector_leng );
}
ZnkStr_add( ans, adp->at_( str_list, end-1 ) );
}
}
示例6: _timer
//Removed thread support!
uint64 Adapter::_timer(void* arg)
{
TRACE;
// This function is called when the Scheduler's timer proc expires. It
// invokes the provider's timer() method().
Adapter* adapter = (Adapter*)arg;
Auto_RMutex auto_lock(adapter->_lock);
uint64 timeout = 0;
Timer_Status status = adapter->timer(timeout);
switch (status)
{
case TIMER_CANCEL:
return 0;
case TIMER_RESCHEDULE:
// Convert to microseconds.
return timeout * 1000;
}
// Unreachable!
return 0;
}
示例7: main
int main(int argc, const char * argv[])
{
Adapter* ad = new Adapter();
ad->render();
return 0;
}
示例8: main
int main(int, char **)
{
// create an adapter object and call one of its functions
Adapter adapter;
adapter.DoSomething(42);
return 0;
}
示例9: main
int main(int argc, char **argv)
{
Adaptee *ade = new Adaptee();
Adapter *apt = new Adapter(ade);
apt->Request();
return 0;
}
示例10: writeSolution
void Decorator::writeSolution(
const Epetra_Vector &soln, const double time, const bool overlapped)
{
Adapter *adapter = Adapter::get();
if (adapter)
adapter->update(this->timestep++, time, *this, soln);
discretization->writeSolution(soln, time, overlapped);
}
示例11: Adapter
Adapter * Agent::addAdapter(
const string& device,
const string& host,
const unsigned int port
)
{
Adapter *adapter = new Adapter(device, host, port);
adapter->setAgent(*this);
return adapter;
}
示例12: WriteAdapter
inline void WriteAdapter(Adapter& v, F f)
{
m_jsutil.StartArray();
for (size_t i = 0, size = v.size(); i < size; i++)
{
WriteValue(f());
v.pop();
}
m_jsutil.EndArray();
}
示例13: associators
CMPIStatus Adapter::associators(
CMPIAssociationMI* mi,
const CMPIContext* context,
const CMPIResult* result,
const CMPIObjectPath* cmpi_op,
const char* assoc_class_,
const char* result_class_,
const char* role_,
const char* result_role_,
const char** properties)
{
TRACE;
const char* assoc_class = assoc_class_ ? assoc_class_ : "";
const char* result_class = result_class_ ? result_class_ : "";
const char* role = role_ ? role_ : "";
const char* result_role = result_role_ ? result_role_ : "";
_context_tls.set((void*)context);
Adapter* adapter = (Adapter*)mi->hdl;
Auto_RMutex auto_lock(adapter->_lock);
CIMPLE_ASSERT(strcasecmp(assoc_class, adapter->_mc->name) == 0);
// Lookup meta class for cmpi_op (not the same as the provider class).
const Meta_Class* mc = adapter->_find_meta_class(class_name(cmpi_op));
if (!mc)
CMReturn(CMPI_RC_ERR_INVALID_CLASS);
// Convert to CIMPLE reference:
Instance* cimple_ref = 0;
CMPIrc rc = make_cimple_reference(mc, cmpi_op, cimple_ref);
Destroyer<Instance> cimple_ref_d(cimple_ref);
if (rc != CMPI_RC_OK)
CMReturn(rc);
// Invoke the provider:
associators::Data data = { adapter->broker,
context, result, name_space(cmpi_op), properties, CMPI_RC_OK };
Enum_Associator_Names_Status status = adapter->enum_associator_names(
cimple_ref,
result_class,
role,
result_role,
associators::_proc,
&data);
CMReturn(CMPI_RC_OK);
}
示例14: LoadAdapter
void PhysicsNeuralModule::AddAdapter(std::string strXml, bool bDoNotInit)
{
CStdXml oXml;
oXml.Deserialize(strXml);
oXml.FindElement("Root");
oXml.FindChildElement("Adapter");
Adapter *lpAdapter = LoadAdapter(oXml);
if(!bDoNotInit)
lpAdapter->Initialize();
}
示例15: main
int main( int argc, char* argv[] )
{
#if CLASS
Adaptee* ade = new Adaptee();
Adapter* adt = new Adapter();
adt->Request();
#else
Adaptee* ade = new Adaptee();
Adapter* adt = new Adapter( ade );
adt->Request();
#endif
return 0;
}