[brlcad-commits] SF.net SVN: brlcad:[32791]
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <dav...@us...> - 2008-09-30 19:48:01
|
Revision: 32791 http://brlcad.svn.sourceforge.net/brlcad/?rev=32791&view=rev Author: davidloman Date: 2008-09-30 19:47:34 +0000 (Tue, 30 Sep 2008) Log Message: ----------- Continuing Geometry Service Java -> Cpp Conversion. Modified Paths: -------------- rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.h rt^3/trunk/src/geometryService/cpp/stractNet/MsgStop.cpp rt^3/trunk/src/geometryService/cpp/stractNet/MsgStop.h Added Paths: ----------- rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.cpp Added: rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.cpp =================================================================== --- rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.cpp (rev 0) +++ rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.cpp 2008-09-30 19:47:34 UTC (rev 32791) @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////// +// MsgFrag.cpp +// Implementation of the Class MsgStop +// Created on: 06-Aug-2008 7:51:11 AM +// Original author: david.h.loman +/////////////////////////////////////////////////////////// +#include "MsgFrag.h" +/////////////////////////////////////////////////////////////////////// +/* + * + * xSTRUCTORS + * + */ +/////////////////////////////////////////////////////////////////////// +MsgFrag::MsgFrag(String name, E& in, int mfType) { + SNRoot(name); + this->field = in; + this->MFType = mfType; +} +MsgFrag::MsgFrag(String name, DataInputStream& in, int mfType) { + SNRoot(name); + this->MFType = mfType; + this->Deserialize(in); +} +MsgFrag::~MsgFrag() { +} +/////////////////////////////////////////////////////////////////////// +/* + * + * METHODS + * + */ +/////////////////////////////////////////////////////////////////////// + +byte* MsgFrag::Serialize() { + ByteArrayOutputStream baos; + DataOutputStream out; + + try { + this->Serialize(out); + return baos.toByteArray(); //TODO convert these functions to use streams. + } catch (IOException e) { + SNRoot::err("IOException in Serialize()", 0); + } + return null; + +} + +void MsgFrag::Serialize(DataOutputStream& out) { + out.writeInt(this->MFType); + this->Serialize_Specific(out); +} + + +E MsgFrag::getField() { + return this->field; +} + +void MsgFrag::setField(E val) { + this->field = val; +} + +int MsgFrag::getMFType() { + return this->MFType; +} + +std::string MsgFrag::toString() { + std::string out; + out << this->field << "(" << this->name << ")"; + return out; +} + + + + + + + + Property changes on: rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.h =================================================================== --- rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.h 2008-09-30 19:35:08 UTC (rev 32790) +++ rt^3/trunk/src/geometryService/cpp/stractNet/MsgFrag.h 2008-09-30 19:47:34 UTC (rev 32791) @@ -5,8 +5,8 @@ // Original author: david.h.loman /////////////////////////////////////////////////////////// -#if !defined(EA_7F69ABBB_419C_4b74_A909_67A3AFCCEA27__INCLUDED_) -#define EA_7F69ABBB_419C_4b74_A909_67A3AFCCEA27__INCLUDED_ +#if !defined(MSGFRAG_H_INCLUDED_) +#define MSGFRAG_H_INCLUDED_ #include "SNRoot.h" @@ -15,8 +15,6 @@ { public: - MsgFrag(); - virtual ~MsgFrag(); static const int mftBoolean = 0; static const int mftByteArray = 8; static const int mftDouble = 1; @@ -27,45 +25,25 @@ static const int mftString = 6; static const int mftWaypoint = 7; - E getField(){ + virtual ~MsgFrag(); - return NULL; - } - int getMFType(){ + E getField(); //TODO returning by value will not work for objects... + void setField(E val); + int getMFType(); - return MFType; - } - byte Serialize(){ - return NULL; - } - void Serialize(DataOutputStream out) throw IOException{ + byte* Serialize(); //returns pointer to byte array //TODO Is this the best way to do this? Why not hand the socket stream right to the serializer instead of going through a byte array? + void Serialize(DataOutputStream& out); - } - void setField(E val){ + std::string toString(); - } - String toString(){ - - return NULL; - } - protected: E field; int MFType; - MsgFrag(String name, E in, int mfType){ - - } - MsgFrag(String name, DataInputStream in, int mfType){ - - } - virtual void Deserialize(DataInputStream in){ - - } - virtual void Serialize_Specific(DataOutputStream out){ - - } - + MsgFrag(String name, E& in, int mfType); + MsgFrag(String name, DataInputStream& in, int mfType); + virtual void Deserialize(DataInputStream& in); + virtual void Serialize_Specific(DataOutputStream& out); }; -#endif // !defined(EA_7F69ABBB_419C_4b74_A909_67A3AFCCEA27__INCLUDED_) +#endif // !defined(MSGFRAG_H_INCLUDED_) Modified: rt^3/trunk/src/geometryService/cpp/stractNet/MsgStop.cpp =================================================================== --- rt^3/trunk/src/geometryService/cpp/stractNet/MsgStop.cpp 2008-09-30 19:35:08 UTC (rev 32790) +++ rt^3/trunk/src/geometryService/cpp/stractNet/MsgStop.cpp 2008-09-30 19:47:34 UTC (rev 32791) @@ -4,50 +4,50 @@ // Created on: 06-Aug-2008 7:51:11 AM // Original author: david.h.loman /////////////////////////////////////////////////////////// - #include "MsgStop.h" +/////////////////////////////////////////////////////////////////////// +/* + * + * xSTRUCTORS + * + */ +/////////////////////////////////////////////////////////////////////// +MsgStop::~MsgStop(){} +MsgStop::MsgStop(std::string Name, std::Set<Integer> msgTypes, std::List<StdMsg> inQ){ + SNRoot(Name); + this->MsgTypes = msgTypes; + this->msgQ = inQ; -MsgStop::MsgStop(){ - + this->addMsgType(StdMsgTypes::mtBroadcast); + this->addMsgType(StdMsgTypes::mtHello); } +MsgStop::MsgStop(std::string Name, std::List<StdMsg> inQ){ + SNRoot(Name); + this->MsgTypes = msgTypes; + this->msgQ = inQ; + this->addMsgType(StdMsgTypes::mtBroadcast); + this->addMsgType(StdMsgTypes::mtHello); - -MsgStop::~MsgStop(){ - } +void MsgStop::addMsgType(int msgType){ - - -MsgStop::MsgStop(String Name, HashSet<Integer> msgTypes, LinkedList<StdMsg> inQ){ - } + void addMsgTypes(std::Set<Integer> msgTypes) { -MsgStop::MsgStop(String Name, LinkedList<StdMsg> inQ){ + } -} +void MsgStop::addMsgTypes(int msgTypes[]){ -void MsgStop::addMsgType(int msgType){ - } -/** - * public void addMsgTypes(HashSet<Integer> msgTypes) { MsgTypes.addAll(MsgTypes); - * } - */ -void MsgStop::addMsgTypes(int[] msgTypes){ - -} - - -HashSet<Integer> MsgStop::getMsgTypesHashSet(){ - +std::Set<Integer> MsgStop::getMsgTypesSet(){ return NULL; } @@ -70,4 +70,4 @@ void MsgStop::sendToMsgStop(StdMsg msg){ -} \ No newline at end of file +} Modified: rt^3/trunk/src/geometryService/cpp/stractNet/MsgStop.h =================================================================== --- rt^3/trunk/src/geometryService/cpp/stractNet/MsgStop.h 2008-09-30 19:35:08 UTC (rev 32790) +++ rt^3/trunk/src/geometryService/cpp/stractNet/MsgStop.h 2008-09-30 19:47:34 UTC (rev 32791) @@ -5,26 +5,29 @@ // Original author: david.h.loman /////////////////////////////////////////////////////////// -#if !defined(EA_F1D00E32_F7E9_4409_8C53_5C60B1234B36__INCLUDED_) -#define EA_F1D00E32_F7E9_4409_8C53_5C60B1234B36__INCLUDED_ +#if !defined(MSGSTOP_H_INCLUDED_) +#define MSGSTOP_H_INCLUDED_ #include "StdMsg.h" #include "SNRoot.h" +#include "StdMsgTypes.h" class MsgStop : public SNRoot { public: - MsgStop(); virtual ~MsgStop(); - MsgStop(String Name, HashSet<Integer> msgTypes, LinkedList<StdMsg> inQ); - MsgStop(String Name, LinkedList<StdMsg> inQ); + MsgStop(std::string Name, std::Set<Integer> msgTypes, std::List<StdMsg> inQ); + MsgStop(std::string Name, std::List<StdMsg> inQ); + void addMsgType(int msgType); - void addMsgTypes(int[] msgTypes); - HashSet<Integer> getMsgTypesHashSet(); + void addMsgTypes(int msgTypes[]); + void remMsgType(int msgType); + + std::Set<Integer> getMsgTypesSet(); int getMsgTypesIntArray(); - void remMsgType(int msgType); + void sendToMS(StdMsg msg); void sendToMsgStop(StdMsg msg); @@ -33,8 +36,8 @@ * This is a reference to the Queue for messages coming FROM the MS to the * destined MsgStop */ - LinkedList<StdMsg> msgQ; - HashSet<Integer> MsgTypes; + std::List<StdMsg> msgQ; + std::Set<Integer> MsgTypes; }; -#endif // !defined(EA_F1D00E32_F7E9_4409_8C53_5C60B1234B36__INCLUDED_) +#endif // !defined(MSGSTOP_H_INCLUDED_) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |