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


C++ postMessage函数代码示例

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


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

示例1: switch

void crashutils::onSelect(entry *selectedEntry, int selItemIndex)
{
  //...
  switch (selectedEntry->type)
  {
    case 1:  postMessage(MSG_SELECT_SVTX, (param)selectedEntry, (param)selItemIndex); break;
    case 3:  postMessage(MSG_SELECT_WGEO, (param)selectedEntry);                      break;
    case 7:  postMessage(MSG_SELECT_ZDAT, (param)selectedEntry);                      break;
    case 11: postMessage(MSG_SELECT_GOOL, (param)selectedEntry);                      break;
  }
}
开发者ID:Almamu,项目名称:crashutils,代码行数:11,代码来源:crashutils.cpp

示例2: while

//---------------------------------------------------------------------------
void __fastcall TMessGen::Timer2Timer(TObject *Sender)
{
    TBytes ab;
    int length;
    UnicodeString host = IdUDPClient1->Host;
    WORD port = IdUDPClient1->Port;

    Timer2->Enabled = 0;
    ab.Length = 1000;
    try {
        while ((length = IdUDPClient1->ReceiveBuffer(ab, host, port, 100)) > 0) {
            BYTE *data = new BYTE[length];
			for (int i = 0; i <length; ++i) {
				data[i] = ab[i];
			}
//            message("RX: %s:%d [%d]: %d/%d (%d) %s",
//                AnsiString(IdUDPClient1->Host).c_str(), IdUDPClient1->Port, length,
//                data[0], data[1], *(WORD*)(data+2), data + 8);
            switch (data[1]) {
            case 0:     // registration response
//                message("    Registration response");
                break;
            case 2:     // response
//                message("    %04X/%d %s", *(DWORD*)(data+32), *(DWORD*)(data+32+4), data+32+8);
                postMessage(*(DWORD*)(data+32), *(DWORD*)(data+32+4));
                break;
            case 90:
//                message("    Setup has been changed");
                postMessage(2, 0);
                break;
            case 98:
//                message("    Message: %s", data+32);
                break;
            case 99:
//                message("    Error %d[%08X]", *(DWORD*)(data+32), *(DWORD*)(data+32));
                break;
            default:
//                message("Unknown message type %d/%d", data[1]);
                break;
            }

        }
    }
    catch (...) {
//        message("Connection broken");
    }
    Timer2->Enabled = 1;
}
开发者ID:selwynjackson,项目名称:MessageGenerator,代码行数:49,代码来源:MessageGeneratorMain.cpp

示例3: msgWork

    void msgWork(const Pothos::Packet &inPkt)
    {
        //calculate conversion and buffer sizes (round up)
        const size_t numSyms = (inPkt.payload.length + _mod - 1)/_mod;

        //create a new packet for output symbols
        Pothos::Packet outPkt;
        auto outPort = this->output(0);
        outPkt.payload = outPort->getBuffer(numSyms);

        //perform conversion
        auto in = inPkt.payload.as<const unsigned char*>();
        auto out = outPkt.payload.as<unsigned char*>();
        switch (_order)
        {
        case MSBit: ::bitsToSymbolsMSBit(_mod, in, out, numSyms); break;
        case LSBit: ::bitsToSymbolsLSBit(_mod, in, out, numSyms); break;
        }

        //copy and adjust labels
        for (const auto &label : inPkt.labels)
        {
            outPkt.labels.push_back(label.toAdjusted(1, _mod));
        }

        //post the output packet
        outPort->postMessage(outPkt);
    }
开发者ID:pothosware,项目名称:pothos-comms,代码行数:28,代码来源:BitsToSymbols.cpp

示例4: QLatin1String

// Logging functions
void MainWindow::postInfoMessage(const QString& msg)
{
    static const QString colour = QLatin1String("#3A87AD");
    static const QString leader = QLatin1String("Info");

    postMessage(colour, leader, msg);
}
开发者ID:DuFace,项目名称:DailyProgrammer,代码行数:8,代码来源:mainwindow.cpp

示例5: work

    void work(void)
    {
        auto inPort = this->input(0);
        auto outPort = this->output(0);
        inPort->setReserve(_mod);

        //handle packet conversion if applicable
        if (inPort->hasMessage())
        {
            auto msg = inPort->popMessage();
            if (msg.type() == typeid(Pothos::Packet))
                this->msgWork(msg.extract<Pothos::Packet>());
            else outPort->postMessage(msg);
            return; //output buffer used, return now
        }

        //calculate work size
        const size_t numSyms = std::min(inPort->elements() / _mod, outPort->elements());
        if (numSyms == 0) return;

        //perform conversion
        auto in = inPort->buffer().as<const unsigned char *>();
        auto out = outPort->buffer().as<unsigned char *>();
        switch (_order)
        {
        case MSBit: ::bitsToSymbolsMSBit(_mod, in, out, numSyms); break;
        case LSBit: ::bitsToSymbolsLSBit(_mod, in, out, numSyms); break;
        }

        //produce/consume
        inPort->consume(numSyms * _mod);
        outPort->produce(numSyms);
    }
开发者ID:pothosware,项目名称:pothos-comms,代码行数:33,代码来源:BitsToSymbols.cpp

示例6: setRemoteClock

bool Round::RemoteNode::postMessage(uHTTP::HTTPRequest *httpReq, NodeResponse *nodeRes, Error *error) {
  // HTTP Request
  
  JSONObject *rootObj = NULL;
  if (!postMessage(httpReq, &rootObj, error))
    return false;
  
  if (!rootObj->isDictionary()) {
    RPC::JSON::ErrorCodeToError(RPC::JSON::ErrorCodeParserError, error);
    return false;
  }
  
  JSONDictionary *jsonDict = dynamic_cast<JSONDictionary *>(rootObj);
  if (!jsonDict) {
    RPC::JSON::ErrorCodeToError(RPC::JSON::ErrorCodeParserError, error);
    return false;
  }
  
  nodeRes->set(jsonDict);
  
  // Update local clock
  
  clock_t remoteTs;
  if (nodeRes->getTimestamp(&remoteTs)) {
    setRemoteClock(remoteTs);
  }
  
  return true;
}
开发者ID:cybergarage,项目名称:round-cc,代码行数:29,代码来源:RemoteNode.cpp

示例7: postMessage

//==============================================================================
void MainContentComponent::handleIncomingMidiMessage (MidiInput* /*source*/, const MidiMessage &message)
{
    // This is called on the MIDI thread

    if (message.isNoteOnOrOff())
        postMessage (new MidiCallbackMessage (message));
}
开发者ID:Neknail,项目名称:JUCE,代码行数:8,代码来源:MainComponent.cpp

示例8: msgWork

    void msgWork(const Pothos::Packet &inPkt)
    {
        //calculate conversion and buffer sizes (round up)
        const size_t numBytes = ((inPkt.payload.length + _reserveBytes - 1)/_reserveBytes)*_reserveBytes;
        const size_t numSyms = (numBytes*8)/_mod;

        //create a new packet for output symbols
        Pothos::Packet outPkt;
        auto outPort = this->output(0);
        if (outPort->elements() >= numSyms)
        {
            outPkt.payload = outPort->buffer();
            outPkt.payload.length = numSyms;
            outPort->popBuffer(numSyms);
        }
        else outPkt.payload = Pothos::BufferChunk(outPort->dtype(), numSyms);

        //perform conversion
        auto in = inPkt.payload.as<const unsigned char*>();
        auto out = outPkt.payload.as<unsigned char*>();
        switch (_order)
        {
        case MSBit: ::bytesToSymbolsMSBit(_mod, in, out, numBytes); break;
        case LSBit: ::bytesToSymbolsLSBit(_mod, in, out, numBytes); break;
        }

        //copy and adjust labels
        for (const auto &label : inPkt.labels)
        {
            outPkt.labels.push_back(label.toAdjusted(8, _mod));
        }

        //post the output packet
        outPort->postMessage(outPkt);
    }
开发者ID:xloem,项目名称:pothos,代码行数:35,代码来源:BytesToSymbols.cpp

示例9: yield

void TaoClientTask::requestShutdown()
{
        // Need to put a Mutex on the call stack


        // Pass the shut down to itself
        OsServerTask::requestShutdown();
        yield();

        if (mpConnectionSocket)
        {
                TaoMessage msg = TaoMessage(TaoMessage::REQUEST_PROVIDER,
                                                                                        TaoMessage::SHUTDOWN,
                                                                                        0,
                                                                                        0,
                                                                                        (TaoObjHandle)mpConnectionSocket,
                                                                                        0,
                                                                                        "");

                postMessage(msg);
        }

        if(mpTransport)
        {
                osPrintf("---- TaoClientTask::initInstance: stoping transport\n");
                mpTransport->stopListening();    // shut down the transport task
                mpTransport->requestShutdown();    // shut down the transport task
        }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:29,代码来源:TaoClientTask.cpp

示例10: postMessage

void WindowButton::onMenuUp()
{
	m_Flags &= ~DEPRESSED;

	// post message to listeners
	postMessage( WB_MENUUP, StringHash( name() ), 0 );
}
开发者ID:BlackYoup,项目名称:medusa,代码行数:7,代码来源:WindowButton.cpp

示例11: sqrt

void context_plugin_camera_trans::onSmoothTrans(point *apr)
{
  doTrans = true;
  
  aprX = ((float)apr->X/0x1000)*8;
  aprY = ((float)apr->Y/0x1000)*8;
  aprZ = ((float)apr->Z/0x1000)*8;
  
  dirX = (aprX - contextCamera->location.X);
  dirY = (aprY - contextCamera->location.Y);
  dirZ = (aprZ - contextCamera->location.Z);
  
  float scale = (float) sqrt((dirX*dirX) + (dirY*dirY) + (dirZ*dirZ));
  
  dirX /= scale;
  dirY /= scale;
  dirZ /= scale;
  
  // 50 = n = number of times a constant
  // 'accel' needs to increasingly accumulate and then 
  // decreasingly decumulate speed such that accumulation
  // of position with that updated speed each time will
  // reach 'scale'; approx 50 frames for a camera jump
  int n = 15;
  accel = (scale)/(n*n);
  
  max = accel*((n*(n+1))/2);
    
  speed = 0;
  phase = false;
  
  postMessage(GSM_INVALIDATE);
}
开发者ID:Almamu,项目名称:crashutils,代码行数:33,代码来源:camera_trans.cpp

示例12: postMessage

//HANDLED BY context_plugin_section_select
void context_plugin_zone_select::onPoint(int x, int y)
{
  if (contextScene->getViewMode() & (SCENE_VIEWMODE_WGEOSINGLE
                                    | SCENE_VIEWMODE_SVTXSINGLE
                                    | SCENE_VIEWMODE_SPRITESINGLE))
    return;
    
  bool zoneSel = false;
  
  zone_outline *curOutline;
  for (int lp=0; lp<zoneOutlineCount; lp++)
  {
    curOutline = &zoneOutline[lp];
        
    zoneSel = comp_geom::pointInPolygon2d(x, y, curOutline->outline, curOutline->pointCount);
    if (zoneSel)       
      break;
  }
  
  if (zoneSel)
  {
    entry *zone = curOutline->zone;
    postMessage(MSG_SELECT_ZONE, (param)zone);
  }
}
开发者ID:Almamu,项目名称:crashutils,代码行数:26,代码来源:zone_select.cpp

示例13: MpStreamFeeder

OsStatus MprFromStream::realize(UtlString* pBuffer,
                                int flags,
                                StreamHandle &handle,
                                OsNotification* pEvent)
{
   OsStatus status = OS_INVALID ;

   // Create and Initialize Feeder
   MpStreamFeeder* pFeeder = new MpStreamFeeder(pBuffer, flags) ;
   if (pEvent != NULL)
      pFeeder->setEventHandler(pEvent) ;

   // Realize
   status = pFeeder->realize() ;

   // If not successful, cleanup.
   if (status == OS_SUCCESS)
   {
       STREAMDESC* pDesc = new STREAMDESC ;
       pDesc->handle = (void*) miStreamCount++ ;
       pDesc->pFeeder = pFeeder ;
       mStreamList.push(pDesc) ;
       handle = pDesc->handle ;
   }
   else
   {
      MpFlowGraphMsg msg(SOURCE_DESTROY, this, pFeeder, 0, 0, 0);
      postMessage(msg);
   }

   return status ;
}
开发者ID:ciuc,项目名称:sipxecs,代码行数:32,代码来源:MprFromStream.cpp

示例14: TEST

TEST(chatpresenter, test_postingMessages)
{
    Poco::SharedPtr<MockChatService> m(new MockChatService);

    Mvp::Presenter::TextChatPresenter presenter(m.get());
    Poco::SharedPtr<MockChatView> v(new MockChatView());
    EXPECT_CALL(*v, initialize());

    ON_CALL(*m, getParticipants())
        .WillByDefault(Return(contacts));
    ON_CALL(*m, messageHistory(_))
        .WillByDefault(Return(messages));

    EXPECT_CALL(*m, chatName());
    EXPECT_CALL(*v, setChatTitle(_));
    EXPECT_CALL(*m, messageHistory(_));
    EXPECT_CALL(*m, isConsumer());
    EXPECT_CALL(*v, enableControls(_));
    EXPECT_CALL(*v, showLeaveAction(_));
    EXPECT_CALL(*m, getParticipants());
    EXPECT_CALL(*v, setParticipants(_));
    presenter.setView(v.get());

    EXPECT_CALL(*v, showView());
    presenter.showView();

    EXPECT_CALL(*m, postMessage(_));
    v->triggerPostMessage();
}
开发者ID:goodinges,项目名称:Ciao-Chat,代码行数:29,代码来源:test-textchatpresenter.cpp

示例15: Java_org_skia_viewer_ViewerActivity_onSurfaceChanged

extern "C" JNIEXPORT void JNICALL Java_org_skia_viewer_ViewerActivity_onSurfaceChanged(
    JNIEnv* env, jobject activity, jlong handle, jobject surface) {
    auto skiaAndroidApp = (SkiaAndroidApp*)handle;
    Message message(kSurfaceChanged);
    message.fNativeWindow = ANativeWindow_fromSurface(env, surface);
    skiaAndroidApp->postMessage(message);
}
开发者ID:VarcoDevs,项目名称:skia,代码行数:7,代码来源:surface_glue_android.cpp


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