Commit 36a461ed by David Heitbrink

minor update, mostly fixed warnings

parent dbef1c96
cmake_minimum_required(VERSION 3.2)
project(NADS_DDSLIB CXX)
################################################################################
# Source groups
################################################################################
set(CMAKE_C_FLAGS "-Wall -g")
set (SRC
apex_memmove.cpp
DDSSimClient.cpp
NADSPlugin.cxx
NADS.cxx
stdafx.cpp
)
set (HEADERS
apex_memmove.h
stdafx.h
targetver.h
NADS.hpp
NADSPlugin.hpp
)
set (PUBLIC_INCLUDE
./include/NadsDDSLib/DDSSimClient.h
./include/NadsDDSLib/NadsDDSLib.h
)
set (LIB_SRC
./src/GenericSubscriber.cpp
./src/GenericSubscriber.h
./src/nadsddsimpl.cpp
./src/nadsddsimpl.h
./src/nadsddslib.cpp
./src/value_as_string.cpp
./src/value_as_string.h
)
source_group("Source Files" FILES ${SRC} )
source_group("Header Files" FILES ${HEADERS})
source_group("PUBLIC INCLUDE" FILES ${PUBLIC_INCLUDE} )
source_group("Lib Source" FILES ${LIB_SRC})
################################################################################
# Target
################################################################################
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -DRTI_WIN32)
endif()
add_library(${PROJECT_NAME} STATIC ${SRC} ${HEADERS} ${PUBLIC_INCLUDE} ${LIB_SRC})
target_include_directories(${PROJECT_NAME}
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/./include"
"${CMAKE_CURRENT_SOURCE_DIR}/../nads-boost;"
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/src"
"$ENV{NDDSHOME}/include"
"$ENV{NDDSHOME}/include/ndds"
"$ENV{NDDSHOME}/include/ndds/hpp"
)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 17
CXX_EXCEPTIONS on
)
target_link_directories(${PROJECT_NAME}
PUBLIC
"$ENV{NDDSHOME}/lib/x64Win64VS2017"
)
################################################################################
# Output directory
################################################################################
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}//lib/"
OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}//lib/"
)
......@@ -5,8 +5,24 @@ namespace NDDSClient {
using namespace std;
CCellInputMap::CCellInputMap() {}
void CCellInputMap::RegInpElem(std::string name, void *_pBuffer, const unsigned int _BufferSize, char _BufferType) {
////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn void CCellInputMap::RegInpElem(std::string name, void *_pBuffer, size_t _BufferSize, char _BufferType)
///
/// \brief Registers the inp element
///
/// Saves a copy of the void* _pBuffer, the class saves a reference of the buffer. Its critical
/// the user does not delete the buffer, and the size is accurate.
///
/// \author D A Heitbrink
/// \date 10/7/2020
///
/// \param name The name.
/// \param [in,out] _pBuffer If non-null, the buffer.
/// \param _BufferSize Size of the buffer.
/// \param _BufferType Type of the buffer.
////////////////////////////////////////////////////////////////////////////////////////////////////
void CCellInputMap::RegInpElem(std::string name, void *_pBuffer, size_t _BufferSize, char _BufferType) {
CCellInputMap::TCellRef ref = std::make_unique<CellInput>();
ref->_sub = NADSDDS::CSubscription::MakeSubscription(name, _BufferType);
ref->_size = _BufferSize;
......@@ -53,7 +69,7 @@ namespace NDDSClient {
/// \param _BufferType Type of the buffer.
////////////////////////////////////////////////////////////////////////////////////////////////////
void CCellOutputMap::RegInpElem(std::string name, void *_pBuffer, const unsigned int _BufferSize, char _BufferType) {
void CCellOutputMap::RegInpElem(std::string name, void *_pBuffer, size_t _BufferSize, char _BufferType) {
TCellRef ref = std::make_unique<CellOutput>();
size_t elementSize = 0;
switch (_BufferType) {
......
......@@ -13,6 +13,7 @@
namespace NDDSClient {
class CellInput {
public:
CellInput() :_size(0),_target(nullptr),_type(0) {}
size_t _size;
void* _target;
char _type;
......@@ -31,7 +32,7 @@ namespace NDDSClient {
class CCellInputMap {
public:
CCellInputMap();
void RegInpElem(std::string name, void *_pBuffer, const unsigned int _BufferSize, char _BufferType);
void RegInpElem(std::string name, void *_pBuffer, size_t _BufferSize, char _BufferType);
void ReadInputElements();
private:
typedef std::unique_ptr<CellInput> TCellRef;
......@@ -57,7 +58,7 @@ namespace NDDSClient {
class CCellOutputMap {
public:
CCellOutputMap() {}
void RegInpElem(std::string name, void *_pBuffer, const unsigned int _BufferSize, char _BufferType);
void RegInpElem(std::string name, void *_pBuffer, size_t _BufferSize, char _BufferType);
void WriteOutputElements();
private:
typedef std::unique_ptr<CellOutput> TCellRef;
......
......@@ -23,6 +23,32 @@
#ifdef _X86_
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_32ds.lib")
#endif
#else
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_64ds.lib")
#endif
#endif // DEBUG
#else
#ifdef _X86_
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_32s.lib")
#endif
#else
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_64s.lib")
#endif
#endif // DEBUG
#endif
#endif
#endif
#ifndef NO_AUTOLINK_DDS_LIB
#ifdef _MSC_VER
#pragma comment(lib, "Ws2_32.lib")
#ifdef _DEBUG
#ifdef _X86_
#ifndef NADSDDDS_DLL
#pragma comment(lib,"nddscpp2zd.lib")
#pragma comment(lib,"nddsczd.lib")
#pragma comment(lib,"nddscorezd.lib")
......@@ -32,7 +58,6 @@
#endif
#else
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_64ds.lib")
#pragma comment(lib,"nddscpp2zd.lib")
#pragma comment(lib,"nddsczd.lib")
#pragma comment(lib,"nddscorezd.lib")
......@@ -44,7 +69,6 @@
#else
#ifdef _X86_
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_32s.lib")
#pragma comment(lib,"nddscpp2z.lib")
#pragma comment(lib,"nddscz.lib")
#pragma comment(lib,"nddscorez.lib")
......@@ -54,7 +78,6 @@
#endif
#else
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_64s.lib")
#pragma comment(lib,"nddscpp2z.lib")
#pragma comment(lib,"nddscz.lib")
#pragma comment(lib,"nddscorez.lib")
......@@ -86,7 +109,7 @@ namespace NADSDDS {
class CellRoot {
public:
CellRoot(int id) :_eid(id), _itemCount(0), _period(-1) {
CellRoot(int id) :_eid(id), _itemCount(0), _period(-1),_sizeInBytes(0) {
}
virtual void* Raw() = 0;
virtual void Send() = 0;
......
......@@ -110,7 +110,7 @@ namespace NADSDDS {
}
CStatePriv::CStatePriv() {
CStatePriv::CStatePriv():_frame(0) {
_newFrameCb = make_shared<CStatePriv::OnNewFrame>(this);
_FrameSub = std::make_unique<DataStream<TypeInt>>("Frame", &DDSDomainRepo::GetDomain(0), _newFrameCb);
_StateSub = std::make_unique<TIntSubscription>("StateMode");
......
......@@ -134,7 +134,7 @@ namespace NADSDDS {
public:
typedef unique_ptr<CellPub<TypeFloat>> TRef;
CFloatPub(TRef &&in) :_ref(std::move(in)) {};
CFloatPub(CFloatPub &&in) :_ref(std::move(in._ref)) {}
CFloatPub(CFloatPub &&in) noexcept :_ref(std::move(in._ref)){}
TRef _ref;
CellPub<TypeFloat>* get() { return _ref.get(); }
CellPub<TypeFloat>* operator->() { return _ref.get(); }
......@@ -153,7 +153,7 @@ namespace NADSDDS {
public:
typedef unique_ptr<CellPub<TypeDouble>> TRef;
CDoublePub(TRef &&in) :_ref(std::move(in)) {};
CDoublePub(CDoublePub &&in) :_ref(std::move(in._ref)) {}
CDoublePub(CDoublePub &&in) noexcept :_ref(std::move(in._ref)) {}
TRef _ref;
CellPub<TypeDouble>* get() { return _ref.get(); }
CellPub<TypeDouble>* operator->() { return _ref.get(); }
......@@ -172,7 +172,7 @@ namespace NADSDDS {
public:
typedef unique_ptr<CellPub<TypeChar>> TRef;
CCharPub(TRef &&in) :_ref(std::move(in)) {};
CCharPub(CCharPub &&in) :_ref(std::move(in._ref)) {}
CCharPub(CCharPub &&in) noexcept :_ref(std::move(in._ref)) {}
TRef _ref;
CellPub<TypeChar>* get() { return _ref.get(); }
CellPub<TypeChar>* operator->() { return _ref.get(); }
......@@ -193,7 +193,7 @@ namespace NADSDDS {
public:
typedef unique_ptr<CellPub<TypeInt>> TRef;
CIntPub(TRef &&in):_ref(std::move(in)) {};
CIntPub(CIntPub &&in ):_ref(std::move(in._ref)){}
CIntPub(CIntPub &&in ) noexcept:_ref(std::move(in._ref)){}
TRef _ref;
CellPub<TypeInt>* get() { return _ref.get(); }
CellPub<TypeInt>* operator->() { return _ref.get(); }
......@@ -212,7 +212,7 @@ namespace NADSDDS {
public:
typedef unique_ptr<CellPub<TypeShort>> TRef;
CShortPub(TRef &&in) :_ref(std::move(in)) {};
CShortPub(CShortPub &&in) :_ref(std::move(in._ref)) {}
CShortPub(CShortPub &&in) noexcept:_ref(std::move(in._ref)) {}
operator CellPub<TypeShort>* () { return _ref.get(); }
CellPub<TypeShort>* operator()() { return _ref.get(); }
TRef _ref;
......@@ -249,7 +249,7 @@ namespace NADSDDS {
template < class T> class DataListener : public dds::sub::NoOpDataReaderListener<T> {
public:
typedef std::shared_ptr<OnNewData<T>> TCbRef;
DataListener(TCbRef ref) :_cb(ref) {};
DataListener(TCbRef ref) :_cb(ref),_hasData(false) {};
void on_data_available(dds::sub::DataReader<T>& reader) {
dds::sub::LoanedSamples<T> samples = reader.take();
rti::sub::SampleIterator<T> it;// = dds::sub::LoanedSamples<T>::iterator
......
......@@ -73,7 +73,7 @@ void DoublePublication::Set(const std::string& str){
stringstream converter(str);
double val;
converter >> val;
int size = Count();
size_t size = Count();
for (int i = 0; i < size; i++) {
converter >> val;
(*this)[i] = val;
......@@ -129,7 +129,7 @@ void FloatPublication::Set(const std::string& str) {
stringstream converter(str);
float val;
converter >> val;
int size = Count();
size_t size = Count();
for (int i = 0; i < size; i++) {
converter >> val;
(*this)[i] = val;
......@@ -164,7 +164,7 @@ void ShortPublication::Set(const std::string& str) {
stringstream converter(str);
short val;
converter >> val;
int size = Count();
size_t size = Count();
for (int i = 0; i < size; i++) {
converter >> val;
(*this)[i] = val;
......@@ -192,7 +192,7 @@ void IntPublication::Set(const std::string& str) {
stringstream converter(str);
int val;
converter >> val;
int size = Count();
size_t size = Count();
for (int i = 0; i < size; i++) {
converter >> val;
(*this)[i] = val;
......@@ -227,7 +227,7 @@ char& CharPublication::operator[] (size_t index) {
}
void CharPublication::Set(const std::string& str) {;
int size = min(Count(), str.size());
size_t size = min(Count(), str.size());
for (int i = 0; i < size; i++) {
(*this)[i] = str[i];
}
......
No preview for this file type
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment