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


C++ PEGASUS_ASSERT函数代码示例

本文整理汇总了C++中PEGASUS_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ PEGASUS_ASSERT函数的具体用法?C++ PEGASUS_ASSERT怎么用?C++ PEGASUS_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PEGASUS_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: openFile

    virtual FILE* openFile(
        const char* path,
        int mode)
    {
        FILE* fhandle = NULL;
        switch (mode)
        {
            case 'r':
                fhandle = fopen(path, "r");
                break;

            case 'w':
                fhandle = fopen(path, "w");
                break;

            case 'a':
                fhandle = fopen(path, "a+");
                break;

            default:
                PEGASUS_ASSERT(fhandle);
                break;
        }

        if(!fhandle)
        {
            PEG_TRACE((TRC_SERVER, Tracer::LEVEL1,
                "Open of file %s in mode %c failed: %s",path,mode,
                (const char*) PEGASUS_SYSTEM_ERRORMSG.getCString()));
        }
        return fhandle;
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:32,代码来源:Executor.cpp

示例2: PEGASUS_THREAD_RETURN

Thread::Thread(
    PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *start)(void *),
    void *parameter,
    Boolean detached)
    : _is_detached(detached),
      _cancel_enabled(true),
      _cancelled(false),
      _suspend_count(),
      _start(start),
      _cleanup(true),
      _tsd(true),
      _thread_parm(parameter),
      _exit_code(0)
{
    pthread_attr_init(&_handle.thatt);

#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC)
    size_t stacksize;
    if (pthread_attr_getstacksize(&_handle.thatt, &stacksize) == 0)
    {
       int rc = pthread_attr_setstacksize(&_handle.thatt, stacksize*2);
       PEGASUS_ASSERT(rc == 0);
    }
#endif

    _handle.thid = 0;
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:27,代码来源:ThreadUnix.cpp

示例3: test15

void test15()
{
    VCOUT << "Test assignment CIMName=(char*) ASCII with invalid UTF-8. "
                 "Error in sequence bytes starts at byte index 3...";
    try
    {
        CIMName tempCIMName = utf8BrokenSequenceByte;
    }
    catch(Exception& e)
    {
        String message=e.getMessage();
        String expectedErrorMessage("The byte sequence starting at index 3 "
                                        "is not valid UTF-8 encoding.");
        // check if this is the expected exception
        if (String::equalNoCase(message, expectedErrorMessage))
        {
            VCOUT << " +++++ passed" << endl;
            return;
        }
        else 
        {
            throw;
        }
    }
    PEGASUS_ASSERT(false);
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:26,代码来源:TestCIMName.cpp

示例4: void

Boolean MessageQueueService::SendAsync(
    AsyncOpNode *op,
    Uint32 destination,
    void (*callback)(AsyncOpNode *, MessageQueue *, void *),
    MessageQueue *callback_response_q,
    void *callback_ptr)
{
   PEGASUS_ASSERT(op != 0 && callback != 0);

   // get the queue handle for the destination

   op->lock();
   op->_op_dest = MessageQueue::lookup(destination); // destination of this message
   op->_flags |= ASYNC_OPFLAGS_CALLBACK;
   op->_flags &= ~(ASYNC_OPFLAGS_FIRE_AND_FORGET);
   // initialize the callback data
   op->_async_callback = callback;   // callback function to be executed by recpt. of response
   op->_callback_node = op;          // the op node
   op->_callback_response_q = callback_response_q;  // the queue that will receive the response
   op->_callback_ptr = callback_ptr;   // user data for callback
   op->_callback_request_q = this;     // I am the originator of this request

   op->unlock();
   if (op->_op_dest == 0)
      return false;

   return  _meta_dispatcher->route_async(op);
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:28,代码来源:MessageQueueService.cpp

示例5: _Compare

inline static Boolean _Compare(const T& x, const T& y, WQLOperation op)
{
    switch (op)
    {
        case WQL_EQ:
            return x == y;

        case WQL_NE:
            return x != y;

        case WQL_LT:
            return x < y;
        case WQL_LE:
            return x <= y;

        case WQL_GT:
            return x > y;

        case WQL_GE:
            return x >= y;

        default:
            PEGASUS_ASSERT(0);
    }

    return false;
}
开发者ID:xenserver,项目名称:openpegasus,代码行数:27,代码来源:WQLSelectStatementRep.cpp

示例6: setPropertyValue

void setPropertyValue(CIMInstance& instance, const CIMName& propertyName,
    const Uint32 value)
{
    Uint32 pos;
    PEGASUS_ASSERT(pos = instance.findProperty(propertyName) != PEG_NOT_FOUND);
    instance.getProperty(pos).setValue(CIMValue(value));
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:7,代码来源:ResponseData.cpp

示例7: testAuthenticationFailure_1

//
// Test with invalid userPass
//
void testAuthenticationFailure_1()
{
    String authHeader = String::EMPTY;
    Boolean authenticated;

    LocalAuthenticationHandler  localAuthHandler;

    //
    // Test with invalid auth header
    //
    authHeader = testUser;
    authHeader.append(filePath);
    authHeader.append(challenge);

    authenticated = localAuthHandler.authenticate(authHeader, authInfo);

    if (verbose) cout << "authHeader: " << authHeader << endl;

    if (authenticated)
        if (verbose) cout << "User " + testUser + " authenticated successfully." << endl;
    else
        if (verbose) cout << "User " + testUser + " authentication failed.." << endl;

    PEGASUS_ASSERT(!authenticated);
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:28,代码来源:LocalAuthenticationHandler.cpp

示例8: controlProviderReceiveMessageCallback

// Need a static method to act as a callback for the control provider.
// This doesn't belong here, but I don't have a better place to put it.
static Message* controlProviderReceiveMessageCallback(
    Message* message,
    void* instance)
{
    CIMRequestMessage* request = dynamic_cast<CIMRequestMessage*>(message);
    PEGASUS_ASSERT(request != 0);

    Thread::setLanguages(
        ((AcceptLanguageListContainer) request->operationContext.get(
            AcceptLanguageListContainer::NAME)).getLanguages());

    ProviderMessageHandler* pmh =
        reinterpret_cast<ProviderMessageHandler*>(instance);

    MessageType reqType = request->getType();
    if (reqType == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE)
    {
        pmh->terminate();
        return 0;
    }
    else if (reqType == CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE)
    {
        pmh->subscriptionInitComplete();
        return 0;
    }
    else if (reqType == CIM_INDICATION_SERVICE_DISABLED_REQUEST_MESSAGE)
    {
        pmh->indicationServiceDisabled();
        return 0;
    }
    return pmh->processMessage(request);
}
开发者ID:govindraopanduru,项目名称:neopegasus,代码行数:34,代码来源:CIMServer.cpp

示例9: PEGASUS_ASSERT

void cimom::_handle_cimom_op(AsyncOpNode *op)
{
    Message* msg = op->getRequest();

    // We handle only one message at present.
    PEGASUS_ASSERT( msg->getType() ==  ASYNC_IOCLOSE);
    _global_this->_routed_queue_shutdown = 1;
    _make_response(msg, async_results::OK);
    // All services are shutdown, empty out the queue
    for(;;)
    {
        AsyncOpNode* operation = 0;
        try
        {
            operation = _global_this->_routed_ops.dequeue();
            if (operation)
            {
                _global_this->cache_op(operation);
            }
            else
            {
                break;
            }
        }
        catch (...)
        {
             break;
        }
    }
    // shutdown the AsyncQueue
    _global_this->_routed_ops.close();
    // exit the routing thread.
    _die++;
}
开发者ID:kaixuanlive,项目名称:openpegasus,代码行数:34,代码来源:Cimom.cpp

示例10: PEG_METHOD_ENTER

void ProviderIndicationCountTable::insertEntry(
    const CIMInstance& providerInstance)
{
    PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
        "ProviderIndicationCountTable::insertEntry");

    String providerModuleName;
    String providerName;
    getProviderKeys(providerInstance, providerModuleName, providerName);

    String providerKey = _generateKey(providerModuleName, providerName);
    _ProviderIndicationCountTableEntry entry;

    WriteLock lock(_tableLock);

    if (!_table.lookup(providerKey, entry))
    {
        //
        // The entry is not in the table yet; insert a new entry.
        //
        _ProviderIndicationCountTableEntry newEntry;
        newEntry.providerModuleName = providerModuleName;
        newEntry.providerName = providerName;
        newEntry.indicationCount = 0;
        newEntry.orphanIndicationCount = 0;

        Boolean succeeded = _table.insert(providerKey, newEntry);
        PEGASUS_ASSERT(succeeded);
    }

    PEG_METHOD_EXIT();
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:32,代码来源:ProviderIndicationCountTable.cpp

示例11: PEG_METHOD_ENTER

void CIMListenerIndicationDispatcher::handleEnqueue(Message* message)
{
    PEG_METHOD_ENTER(TRC_SERVER,
        "CIMListenerIndicationDispatcher::handleEnqueue");

    if(message!=NULL)
    {
        switch (message->getType())
        {
            case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
                {
                    CIMExportIndicationRequestMessage* request =
                        (CIMExportIndicationRequestMessage*)message;

                    CIMExportIndicationResponseMessage* response =
                        static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->
                            handleIndicationRequest(request);

                    MessageQueue* queue = MessageQueue::lookup(response->dest);
                    PEGASUS_ASSERT(queue != 0);
                    queue->enqueue(response);
                }
                break;
            default:
                break;
        }
    delete message;
    }

    PEG_METHOD_EXIT();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:31,代码来源:CIMListenerIndicationDispatcher.cpp

示例12: PEG_METHOD_ENTER

void CMPIProvider::terminate()
{
    PEG_METHOD_ENTER(
        TRC_CMPIPROVIDERINTERFACE,
        "CMPIProvider::terminate()");
    if (_status == INITIALIZED)
    {
        try
        {

            _terminate(true);
            PEGASUS_ASSERT(unloadStatus == CMPI_RC_OK);
        }
        catch (...)
        {
            PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
                "Exception caught in CMPIProviderFacade::Terminate for %s",
                (const char*)getName().getCString()));
            throw;
        }
    }

    // Provider's cleanup method called successfully, if there are still any
    // pending operations with provider then we were asked to cleanup forcibly,
    // don't uninitialize provider.
    if (_current_operations.get() == 0)
    {
        _status = UNINITIALIZED;
    }

    PEG_METHOD_EXIT();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:32,代码来源:CMPIProvider.cpp

示例13: PEG_METHOD_ENTER

CIMHandler* IndicationHandlerService::_lookupHandlerForClass(
   const CIMName& className)
{
   PEG_METHOD_ENTER(TRC_IND_HANDLER,
        "IndicationHandlerService::_lookupHandlerForClass()");

   String handlerId;

   if (className.equal(PEGASUS_CLASSNAME_INDHANDLER_CIMXML) ||
       className.equal(PEGASUS_CLASSNAME_LSTNRDST_CIMXML))
   {
       handlerId = String("CIMxmlIndicationHandler");
   }
   else if (className.equal(PEGASUS_CLASSNAME_INDHANDLER_SNMP))
   {
       handlerId = String("snmpIndicationHandler");
   }
   else if (className.equal(PEGASUS_CLASSNAME_LSTNRDST_SYSTEM_LOG))
       handlerId = String("SystemLogListenerDestination");
   else if (className.equal(PEGASUS_CLASSNAME_LSTNRDST_EMAIL))
       handlerId = String("EmailListenerDestination");

   PEGASUS_ASSERT(handlerId.size() != 0);

   CIMHandler* handler = _handlerTable.getHandler(handlerId, _repository);

   PEG_METHOD_EXIT();
   return handler;
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:29,代码来源:IndicationHandlerService.cpp

示例14: testAuthenticationFailure_4

//
// Test with invalid CIM user or invalid password
//
void testAuthenticationFailure_4()
{
    String authHeader = String::EMPTY;
    Boolean authenticated;

    BasicAuthenticationHandler  basicAuthHandler;

    AuthenticationInfo* authInfo = new AuthenticationInfo(true);

    String userPass = invalidUser;
    userPass.append(":");
    userPass.append(invalidPassword);

    authHeader.append(encodeUserPass(userPass));

    authenticated = basicAuthHandler.authenticate(authHeader, authInfo);

    if (authenticated)
        if (verbose) cout << "User " + testUser + " authenticated successfully." << endl;
    else
        if (verbose) cout << "User " + testUser + " authentication failed." << endl;

    delete authInfo;

    PEGASUS_ASSERT(!authenticated);
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:29,代码来源:BasicAuthenticationHandler.cpp

示例15: PEG_METHOD_ENTER

void DefaultProviderManager::_unloadProvider(ProviderMessageHandler* provider)
{
    //
    // NOTE:  It is the caller's responsibility to make sure that the
    // provider->status.getStatusMutex() mutex is locked before calling
    // this method.
    //

    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
        "DefaultProviderManager::_unloadProvider");

    if (provider->status.numCurrentOperations() > 0)
    {
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
            "Provider cannot be unloaded due to pending operations: %s",
            (const char*)provider->getName().getCString()));
    }
    else
    {
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
            "Terminating Provider %s",
            (const char*)provider->getName().getCString()));

        provider->terminate();

        // unload provider module
        PEGASUS_ASSERT(provider->status.getModule() != 0);
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3,
            "Unloading provider module: %s",
            (const char*)provider->getName().getCString()));
        provider->status.getModule()->unloadModule();

        PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
            "DefaultProviderManager: Unloaded provider %s",
            (const char*)provider->getName().getCString()));

        // NOTE: The "delete provider->status.getCIMOMHandle()" operation
        //   was moved to be called after the unloadModule() call above
        //   as part of a fix for bugzilla 3669. For some providers
        //   run out-of-process on Windows platforms (i.e. running
        //   the cimserver with the forceProviderProcesses config option
        //   set to "true"), deleting the provider's CIMOMHandle before
        //   unloading the provider library caused the unload mechanism
        //   to deadlock, making that provider unavailable and preventing
        //   the cimserver from shutting down. It should NOT be moved back
        //   above the unloadModule() call. See bugzilla 3669 for details.

        // delete the cimom handle
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
            "Destroying provider's CIMOMHandle: %s",
            (const char*)provider->getName().getCString()));
        delete provider->status.getCIMOMHandle();

        // set provider status to uninitialized
        provider->status.setInitialized(false);
    }

    PEG_METHOD_EXIT();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:59,代码来源:DefaultProviderManager.cpp


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