当前位置: 首页>>代码示例>>C++>>正文


C++ Adapter类代码示例

本文整理汇总了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;
    }
}
开发者ID:LegalizeAdulthood,项目名称:cimple,代码行数:31,代码来源:Adapter.cpp

示例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;
}
开发者ID:LegalizeAdulthood,项目名称:cimple,代码行数:30,代码来源:Adapter.cpp

示例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;
}
开发者ID:johnmichaloski,项目名称:MTConnectToolbox,代码行数:26,代码来源:agent.cpp

示例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);
        }
    }
}
开发者ID:mohiul,项目名称:Self-Adaptive-Rock-Paper-Scissor,代码行数:28,代码来源:XMLConfigReader.cpp

示例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 ) );
    }
}
开发者ID:mr-moai-2016,项目名称:znk_project,代码行数:27,代码来源:Znk_str_ex.c

示例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;
}
开发者ID:LegalizeAdulthood,项目名称:cimple,代码行数:27,代码来源:Adapter.cpp

示例7: main

int main(int argc, const char * argv[])
{
    Adapter* ad = new Adapter();
    ad->render();

    
    return 0;
}
开发者ID:NelsonBilber,项目名称:Design-Patterns,代码行数:8,代码来源:main.cpp

示例8: main

int main(int, char **)
{
    // create an adapter object and call one of its functions
    Adapter adapter;
    adapter.DoSomething(42);

    return 0;
}
开发者ID:Xieayu,项目名称:CPlusPlus,代码行数:8,代码来源:main.cpp

示例9: main

int main(int argc, char **argv)
{
    Adaptee *ade = new Adaptee();
    Adapter *apt = new Adapter(ade);

    apt->Request();

    return 0;
}
开发者ID:chenjinlei,项目名称:codebase,代码行数:9,代码来源:main.cpp

示例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);
}
开发者ID:timetravellers,项目名称:Albany,代码行数:9,代码来源:Albany_Catalyst_Decorator.cpp

示例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;
}
开发者ID:jnguyen75,项目名称:cppagent,代码行数:10,代码来源:agent.cpp

示例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();
    }
开发者ID:siwuxian,项目名称:Kapok,代码行数:10,代码来源:Serializer.hpp

示例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);
}
开发者ID:LegalizeAdulthood,项目名称:cimple,代码行数:55,代码来源:Adapter.cpp

示例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();
}
开发者ID:NeuroRoboticTech,项目名称:AnimatLabPublicSource,代码行数:11,代码来源:PhysicsNeuralModule.cpp

示例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;
}
开发者ID:pengdu,项目名称:code-snippet,代码行数:13,代码来源:main.cpp


注:本文中的Adapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。