Omnet++ Question: Using Standard Container Classes for Fields of abstract L3Address SlectedNodes[]; // will use std::vector?
up vote
0
down vote
favorite
I want to use Standard Container Classes for Fields of abstract L3Address SlectedNodes; // will use std::vector? I have made the following message declaration:
enter code here
packet PacketData
@customize(true);
abstract L3Address SlectedNodes; // will use std::vector<L3Address >
In the generated C++ code i write the following C++ file :
#include <iostream>
#include <sstream>
#include "PacketData_m.h"
class PacketDataPacket : public PacketData_Base
protected:
std::vector<L3Address> SlectedNodes;// SlectedNodes= SlectedNodes
// helper method
void unsupported() throw cRuntimeError("unsupported method called");
public:
// SlectedNodes methods
virtual L3Address getSlectedNodes(unsigned int k) return SlectedNodes[k];
virtual void setSlectedNodes(unsigned int k, const L3Address& SlectedNodes)
SlectedNodes[k]=L3Address& SlectedNodes;
virtual void addSlectedNodes(const L3Address& SlectedNodes)
SlectedNodes.push_back(L3Address& SlectedNodes);
virtual void setSlectedNodesArraySize(unsigned int size)
SlectedNodes.resize(size);
virtualL3Address getSlectedNodesArraySize() const return
SlectedNodes.size();
;
Register_Class(PacketData);
Some additional boilerplate code
PacketData_Base::PacketData(const char *name=nullptr, int kind=0)
:PacketData_Base(name,kind)
PacketData_Base:: PacketData(constPacketData& other)
:PacketData_Base(other.getName())
operator=(other);
PacketData& operator=(const PacketData& other)
if (&other==this) return *this;
PacketData_Base::operator=(other);
SlectedNodes = other.SlectedNodes;
virtualPacketData *dup()
return newPacketData(*this);
Is this use of standard container classes (STL) as fields, but ofstd::vector< L3Address> IntVector; is true? is there any wrong?
omnet++
add a comment |
up vote
0
down vote
favorite
I want to use Standard Container Classes for Fields of abstract L3Address SlectedNodes; // will use std::vector? I have made the following message declaration:
enter code here
packet PacketData
@customize(true);
abstract L3Address SlectedNodes; // will use std::vector<L3Address >
In the generated C++ code i write the following C++ file :
#include <iostream>
#include <sstream>
#include "PacketData_m.h"
class PacketDataPacket : public PacketData_Base
protected:
std::vector<L3Address> SlectedNodes;// SlectedNodes= SlectedNodes
// helper method
void unsupported() throw cRuntimeError("unsupported method called");
public:
// SlectedNodes methods
virtual L3Address getSlectedNodes(unsigned int k) return SlectedNodes[k];
virtual void setSlectedNodes(unsigned int k, const L3Address& SlectedNodes)
SlectedNodes[k]=L3Address& SlectedNodes;
virtual void addSlectedNodes(const L3Address& SlectedNodes)
SlectedNodes.push_back(L3Address& SlectedNodes);
virtual void setSlectedNodesArraySize(unsigned int size)
SlectedNodes.resize(size);
virtualL3Address getSlectedNodesArraySize() const return
SlectedNodes.size();
;
Register_Class(PacketData);
Some additional boilerplate code
PacketData_Base::PacketData(const char *name=nullptr, int kind=0)
:PacketData_Base(name,kind)
PacketData_Base:: PacketData(constPacketData& other)
:PacketData_Base(other.getName())
operator=(other);
PacketData& operator=(const PacketData& other)
if (&other==this) return *this;
PacketData_Base::operator=(other);
SlectedNodes = other.SlectedNodes;
virtualPacketData *dup()
return newPacketData(*this);
Is this use of standard container classes (STL) as fields, but ofstd::vector< L3Address> IntVector; is true? is there any wrong?
omnet++
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to use Standard Container Classes for Fields of abstract L3Address SlectedNodes; // will use std::vector? I have made the following message declaration:
enter code here
packet PacketData
@customize(true);
abstract L3Address SlectedNodes; // will use std::vector<L3Address >
In the generated C++ code i write the following C++ file :
#include <iostream>
#include <sstream>
#include "PacketData_m.h"
class PacketDataPacket : public PacketData_Base
protected:
std::vector<L3Address> SlectedNodes;// SlectedNodes= SlectedNodes
// helper method
void unsupported() throw cRuntimeError("unsupported method called");
public:
// SlectedNodes methods
virtual L3Address getSlectedNodes(unsigned int k) return SlectedNodes[k];
virtual void setSlectedNodes(unsigned int k, const L3Address& SlectedNodes)
SlectedNodes[k]=L3Address& SlectedNodes;
virtual void addSlectedNodes(const L3Address& SlectedNodes)
SlectedNodes.push_back(L3Address& SlectedNodes);
virtual void setSlectedNodesArraySize(unsigned int size)
SlectedNodes.resize(size);
virtualL3Address getSlectedNodesArraySize() const return
SlectedNodes.size();
;
Register_Class(PacketData);
Some additional boilerplate code
PacketData_Base::PacketData(const char *name=nullptr, int kind=0)
:PacketData_Base(name,kind)
PacketData_Base:: PacketData(constPacketData& other)
:PacketData_Base(other.getName())
operator=(other);
PacketData& operator=(const PacketData& other)
if (&other==this) return *this;
PacketData_Base::operator=(other);
SlectedNodes = other.SlectedNodes;
virtualPacketData *dup()
return newPacketData(*this);
Is this use of standard container classes (STL) as fields, but ofstd::vector< L3Address> IntVector; is true? is there any wrong?
omnet++
I want to use Standard Container Classes for Fields of abstract L3Address SlectedNodes; // will use std::vector? I have made the following message declaration:
enter code here
packet PacketData
@customize(true);
abstract L3Address SlectedNodes; // will use std::vector<L3Address >
In the generated C++ code i write the following C++ file :
#include <iostream>
#include <sstream>
#include "PacketData_m.h"
class PacketDataPacket : public PacketData_Base
protected:
std::vector<L3Address> SlectedNodes;// SlectedNodes= SlectedNodes
// helper method
void unsupported() throw cRuntimeError("unsupported method called");
public:
// SlectedNodes methods
virtual L3Address getSlectedNodes(unsigned int k) return SlectedNodes[k];
virtual void setSlectedNodes(unsigned int k, const L3Address& SlectedNodes)
SlectedNodes[k]=L3Address& SlectedNodes;
virtual void addSlectedNodes(const L3Address& SlectedNodes)
SlectedNodes.push_back(L3Address& SlectedNodes);
virtual void setSlectedNodesArraySize(unsigned int size)
SlectedNodes.resize(size);
virtualL3Address getSlectedNodesArraySize() const return
SlectedNodes.size();
;
Register_Class(PacketData);
Some additional boilerplate code
PacketData_Base::PacketData(const char *name=nullptr, int kind=0)
:PacketData_Base(name,kind)
PacketData_Base:: PacketData(constPacketData& other)
:PacketData_Base(other.getName())
operator=(other);
PacketData& operator=(const PacketData& other)
if (&other==this) return *this;
PacketData_Base::operator=(other);
SlectedNodes = other.SlectedNodes;
virtualPacketData *dup()
return newPacketData(*this);
Is this use of standard container classes (STL) as fields, but ofstd::vector< L3Address> IntVector; is true? is there any wrong?
omnet++
omnet++
edited Nov 9 at 20:20
DaFois
1,71431418
1,71431418
asked Nov 9 at 16:53
محمد عسيري
12
12
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230120%2fomnet-question-using-standard-container-classes-for-fields-of-abstract-l3addr%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown