⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 networkmessage_rw.cc

📁 certi-SHM-3.0.tar 不错的开源的分布式方针软件 大家多多支持 他是linux
💻 CC
字号:
// -*- mode:C++ ; tab-width:4 ; c-basic-offset:4 ; indent-tabs-mode:nil -*-// ----------------------------------------------------------------------------// CERTI - HLA RunTime Infrastructure// Copyright (C) 2002, 2003  ONERA//// This file is part of CERTI-libCERTI//// CERTI-libCERTI is free software ; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public License// as published by the Free Software Foundation ; either version 2 of// the License, or (at your option) any later version.//// CERTI-libCERTI is distributed in the hope that it will be useful, but// WITHOUT ANY WARRANTY ; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with this program ; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307// USA//// $Id: NetworkMessage_RW.cc,v 3.4 2003/03/21 15:06:46 breholee Exp $// ----------------------------------------------------------------------------#include <config.h>#include "NetworkMessage.hh"#define USE_SHMnamespace certi {static pdCDebug D("MESSAGER", "(messageR) - ");// You can comment this out if you don't want to optimize network messages.#define USE_HEADER_AND_BODY// ----------------// -- Read Socket--// ----------------voidNetworkMessage::read(Socket *socket)    throw (NetworkError,           NetworkSignal){#ifdef USE_SHM  Boolean Result;  SharedMemory shm;  D.Out(pdDebug, "Lecture sur le soket shm");  socket->receive(&shm,0);  D.Out(pdDebug, "Lecture achevee : traitement du Header");  Result = readHeader(&shm);        // 2- if ReadHeader returned RTI_TRUE, Read Body.        if (Result == RTI_TRUE)    {        D.Out(pdDebug, "Traitement du body");        readBody(&shm);    }#else#ifdef USE_HEADER_AND_BODY    Boolean Result ;    // 1- Read Header    Result = readHeader(socket);    // 2- if ReadHeader returned RTI_TRUE, Read Body.    if (Result == RTI_TRUE)        readBody(socket);#else    Socket->receive(this, sizeof(NetworkMessage));#endif#endif}// ------------------------// -- Read Shared Memory --// ------------------------intNetworkMessage::read(SharedMemory *shm, int wait)    throw (NetworkError,           NetworkSignal)           // ----------------------------------------------------//   if (wait) //       wait until a message in shm is available//       return 1 ;//   else//       if (a message in shm is available)//           read the message ;//           return 1 ;//       else//           return 0 ;// ----------------------------------------------------{#ifdef USE_HEADER_AND_BODY    Boolean Result ;            if (shm->qui == EMPTY)        if(wait)            D.Out(pdProtocol, "READ_INIT : Bloqu

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -