Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ns-3.42 compatibility #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/multi-bss/vr-app/model/burst-sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "ns3/traced-callback.h"

#include <unordered_map>
#include <map>

namespace ns3
{
Expand Down
2 changes: 2 additions & 0 deletions model/gym-interface/cpp/ns3-ai-gym-env.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <ns3/object.h>

#include <map>

namespace ns3
{

Expand Down
44 changes: 22 additions & 22 deletions model/msg-interface/ns3-ai-msg-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Ns3AiMsgInterfaceImpl
}
m_sync = segment.find<Ns3AiMsgSync>(lockable_name).first;
}
};
}

~Ns3AiMsgInterfaceImpl()
{
Expand All @@ -128,7 +128,7 @@ class Ns3AiMsgInterfaceImpl
CppSetFinished();
}
}
};
}

typedef boost::interprocess::
allocator<Cpp2PyMsgType, boost::interprocess::managed_shared_memory::segment_manager>
Expand All @@ -149,7 +149,7 @@ class Ns3AiMsgInterfaceImpl
{
assert(!m_useVector);
return m_cpp2pyStruct;
};
}

/**
* Get the struct used in Python to C++ transmission in
Expand All @@ -159,7 +159,7 @@ class Ns3AiMsgInterfaceImpl
{
assert(!m_useVector);
return m_py2CppStruct;
};
}

// use vector for passing multiple structures at once:

Expand All @@ -171,7 +171,7 @@ class Ns3AiMsgInterfaceImpl
{
assert(m_useVector);
return m_cpp2pyVector;
};
}

/**
* Get the vector used in Python to C++ transmission in
Expand All @@ -181,7 +181,7 @@ class Ns3AiMsgInterfaceImpl
{
assert(m_useVector);
return m_py2cppVector;
};
}

// for C++ side:

Expand All @@ -192,7 +192,7 @@ class Ns3AiMsgInterfaceImpl
void CppSendBegin()
{
Ns3AiSemaphore::sem_wait(&m_sync->m_cpp2pyEmptyCount);
};
}

/**
* C++ side stops writing into shared memory, struct-based
Expand All @@ -201,7 +201,7 @@ class Ns3AiMsgInterfaceImpl
void CppSendEnd()
{
Ns3AiSemaphore::sem_post(&m_sync->m_cpp2pyFullCount);
};
}

/**
* C++ side starts reading from shared memory, struct-based
Expand All @@ -210,7 +210,7 @@ class Ns3AiMsgInterfaceImpl
void CppRecvBegin()
{
Ns3AiSemaphore::sem_wait(&m_sync->m_py2cppFullCount);
};
}

/**
* C++ side stops reading from shared memory, struct-based
Expand All @@ -219,7 +219,7 @@ class Ns3AiMsgInterfaceImpl
void CppRecvEnd()
{
Ns3AiSemaphore::sem_post(&m_sync->m_py2cppEmptyCount);
};
}

/**
* C++ side sets the overall status to finished when
Expand All @@ -232,7 +232,7 @@ class Ns3AiMsgInterfaceImpl
CppSendBegin();
m_sync->m_isFinished = true;
CppSendEnd();
};
}

// for Python side:

Expand All @@ -247,7 +247,7 @@ class Ns3AiMsgInterfaceImpl
{
m_isFinished = m_sync->m_isFinished;
}
};
}

/**
* Python side stops reading from shared memory, struct-based
Expand All @@ -256,7 +256,7 @@ class Ns3AiMsgInterfaceImpl
void PyRecvEnd()
{
Ns3AiSemaphore::sem_post(&m_sync->m_cpp2pyEmptyCount);
};
}

/**
* Python side starts writing into shared memory, struct-based
Expand All @@ -265,7 +265,7 @@ class Ns3AiMsgInterfaceImpl
void PySendBegin()
{
Ns3AiSemaphore::sem_wait(&m_sync->m_py2cppEmptyCount);
};
}

/**
* Python side stops writing into shared memory, struct-based
Expand All @@ -274,7 +274,7 @@ class Ns3AiMsgInterfaceImpl
void PySendEnd()
{
Ns3AiSemaphore::sem_post(&m_sync->m_py2cppFullCount);
};
}

/**
* Python side gets whether the simulation is over
Expand All @@ -283,7 +283,7 @@ class Ns3AiMsgInterfaceImpl
{
assert(m_handleFinish);
return m_isFinished;
};
}

private:
Cpp2PyMsgType* m_cpp2pyStruct;
Expand Down Expand Up @@ -313,7 +313,7 @@ class Ns3AiMsgInterface : public Singleton<Ns3AiMsgInterface>
void SetIsMemoryCreator(bool isMemoryCreator)
{
this->m_isMemoryCreator = isMemoryCreator;
};
}

/**
* Sets if both C++ and Python sides use vector. Configuration on
Expand All @@ -322,7 +322,7 @@ class Ns3AiMsgInterface : public Singleton<Ns3AiMsgInterface>
void SetUseVector(bool useVector)
{
this->m_useVector = useVector;
};
}

/**
* Sets if both C++ and Python sides handle finish. Configuration on
Expand All @@ -331,7 +331,7 @@ class Ns3AiMsgInterface : public Singleton<Ns3AiMsgInterface>
void SetHandleFinish(bool handleFinish)
{
this->m_handleFinish = handleFinish;
};
}

/**
* Sets shared memory segment size, only valid for
Expand All @@ -341,7 +341,7 @@ class Ns3AiMsgInterface : public Singleton<Ns3AiMsgInterface>
void SetMemorySize(uint32_t size)
{
this->m_size = size;
};
}

/**
* Sets the names of the named objects. See Boost's
Expand All @@ -357,7 +357,7 @@ class Ns3AiMsgInterface : public Singleton<Ns3AiMsgInterface>
this->m_cpp2pyMsgName = cpp2pyMsgName;
this->m_py2cppMsgName = py2cppMsgName;
this->m_lockableName = lockableName;
};
}

/**
* Gets the impl which has semaphore (synchronization)
Expand All @@ -376,7 +376,7 @@ class Ns3AiMsgInterface : public Singleton<Ns3AiMsgInterface>
this->m_py2cppMsgName.c_str(),
this->m_lockableName.c_str());
return &interface;
};
}

private:
bool m_isMemoryCreator;
Expand Down