Skip to content

Commit cf7a86b

Browse files
author
Christoph Ruecker
committed
[FEATURE] Add initial class structure
- Add CMAKE build configuration - Add Doxygen documentation - Add wrapper folder - Add base folder structure - Add base unit test structure Change-Id: I5d314a9b48d0e2ce13769b7113ab0835fb291a23 Signed-off-by: Christoph Ruecker <[email protected]>
1 parent 6c09acd commit cf7a86b

File tree

106 files changed

+9802
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+9802
-0
lines changed

CMakeLists.txt

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
################################################################################
2+
#
3+
# Project: openCONFIGURATOR
4+
#
5+
# (c) Bernecker + Rainer Industrie-Elektronik Ges.m.b.H.
6+
# B&R Strasse 1, A-5142 Eggelsberg
7+
# www.br-automation.com
8+
#
9+
# Description: Main CMAKE file of openCONFIGURATOR library
10+
#
11+
# License:
12+
#
13+
# Redistribution and use in source and binary forms, with or without
14+
# modification, are permitted provided that the following conditions
15+
# are met:
16+
#
17+
# 1. Redistributions of source code must retain the above copyright
18+
# notice, this list of conditions and the following disclaimer.
19+
#
20+
# 2. Redistributions in binary form must reproduce the above copyright
21+
# notice, this list of conditions and the following disclaimer in the
22+
# documentation and/or other materials provided with the distribution.
23+
#
24+
# 3. Neither the name of the copyright holders nor the names of its
25+
# contributors may be used to endorse or promote products derived
26+
# from this software without prior written permission. For written
27+
# permission, please contact [email protected].
28+
#
29+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
32+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33+
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
39+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40+
# POSSIBILITY OF SUCH DAMAGE.
41+
#
42+
# Severability Clause:
43+
#
44+
# If a provision of this License is or becomes illegal, invalid or
45+
# unenforceable in any jurisdiction, that shall not affect:
46+
# 1. the validity or enforceability in that jurisdiction of any other
47+
# provision of this License; or
48+
# 2. the validity or enforceability in other jurisdictions of that or
49+
# any other provision of this License.
50+
#
51+
################################################################################
52+
# Ensure working support of ADD_JAR command
53+
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12)
54+
55+
INCLUDE(CMakeDependentOption)
56+
57+
PROJECT (OPEN_CONFIGURATOR)
58+
###############################################################################
59+
# Compiler flags for MS Visual Studio
60+
###############################################################################
61+
IF(MSVC)
62+
SET(CMAKE_CXX_FLAGS "/wd\"4512\" /wd\"4251\" /Zi /nologo /W4 /WX- /Od /Oy- /Ob0 /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /Gm- /EHsc /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /analyze- /errorReport:queue /GR")
63+
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
64+
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /DDEBUG")
65+
STRING(FIND "${CMAKE_GENERATOR}" "Win64" FOUND)
66+
IF(${FOUND} EQUAL -1)
67+
SET(INSTALL_DIR "${CMAKE_SOURCE_DIR}/bin/win32/x86/\${BUILD_TYPE}")
68+
SET(INSTALL_DIR_VS "${CMAKE_SOURCE_DIR}/bin/win32/x86/$(Configuration)")
69+
ELSE()
70+
SET(INSTALL_DIR "${CMAKE_SOURCE_DIR}/bin/win32/x86_64/\${BUILD_TYPE}")
71+
SET(INSTALL_DIR_VS "${CMAKE_SOURCE_DIR}/bin/win32/x86_64/$(Configuration)")
72+
ENDIF()
73+
ELSEIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
74+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Weffc++ -std=c++11")
75+
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
76+
IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
77+
SET(INSTALL_DIR "${CMAKE_SOURCE_DIR}/bin/linux/x86_64")
78+
ELSE()
79+
SET(INSTALL_DIR "${CMAKE_SOURCE_DIR}/bin/linux/x86")
80+
ENDIF()
81+
IF(MINGW)
82+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U__STRICT_ANSI__ -D__NO_INLINE__ -Wl,--kill-at")
83+
ENDIF(MINGW)
84+
ENDIF(MSVC)
85+
###############################################################################
86+
# Find BOOST libraries
87+
###############################################################################
88+
SET(Boost_DEBUG TRUE)
89+
SET(Boost_USE_STATIC_RUNTIME OFF)
90+
SET(Boost_ADDITIONAL_VERSIONS "1.54.0" "1.55.0")
91+
FIND_PACKAGE(Boost COMPONENTS log date_time filesystem system thread REQUIRED)
92+
# Necessary for Auto-Linking under VS, ignored under Unix
93+
ADD_DEFINITIONS(/DBOOST_ALL_DYN_LINK)
94+
IF(NOT Boost_FOUND)
95+
MESSAGE(SEND_ERROR "Boost libraries not found. Please add BOOST_ROOT environment variable to system.")
96+
ENDIF()
97+
98+
###############################################################################
99+
# Set options
100+
###############################################################################
101+
OPTION (OPEN_CONFIGURATOR_CORE_NET_WRAPPER "Build openCONFIGURATOR core C# wrapper library." OFF)
102+
OPTION (OPEN_CONFIGURATOR_CORE_JAVA_WRAPPER "Build openCONFIGURATOR core Java wrapper library." OFF)
103+
OPTION (OPEN_CONFIGURATOR_CORE_UNIT_TESTS "Build openCONFIGURATOR core unit tests." OFF)
104+
OPTION (OPEN_CONFIGURATOR_CORE_DOCUMENTATION "Build openCONFIGURATOR core source code documentation." OFF)
105+
106+
###############################################################################
107+
# Add a target to generate API documentation with Doxygen
108+
###############################################################################
109+
IF(OPEN_CONFIGURATOR_CORE_DOCUMENTATION)
110+
FIND_PACKAGE(Doxygen REQUIRED)
111+
IF(DOXYGEN_FOUND)
112+
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/resources/doc/openconfigurator_core.doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
113+
ADD_CUSTOM_TARGET(
114+
DOCUMENTATION ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
115+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
116+
COMMENT "Generating API documentation with Doxygen" VERBATIM
117+
)
118+
ELSE(DOXYGEN_FOUND)
119+
MESSAGE(SEND_ERROR "Doxygen installation not found. Please install doxygen and add binary to system path.")
120+
ENDIF(DOXYGEN_FOUND)
121+
ENDIF()
122+
123+
###############################################################################
124+
# Add a target to generate the openCONFIGURATOR library
125+
###############################################################################
126+
ADD_SUBDIRECTORY(library)
127+
128+
###############################################################################
129+
# Add a target to generate .NET wrapper
130+
###############################################################################
131+
IF(OPEN_CONFIGURATOR_CORE_NET_WRAPPER)
132+
# ADD_SUBDIRECTORY(wrapper/csharp)
133+
ENDIF()
134+
135+
###############################################################################
136+
# Add a target to generate Java wrapper
137+
###############################################################################
138+
IF(OPEN_CONFIGURATOR_CORE_JAVA_WRAPPER)
139+
# ADD_SUBDIRECTORY(wrapper/java)
140+
ENDIF()
141+
142+
###############################################################################
143+
# Add a target to generate CPPUNIT tests
144+
###############################################################################
145+
IF(OPEN_CONFIGURATOR_CORE_UNIT_TESTS)
146+
ADD_SUBDIRECTORY(test)
147+
ENDIF()
148+

bin/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
.*
3+
!.gitignore
4+

build/linux/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
.*
3+
!.gitignore

build/windows/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
.*
3+
!.gitignore

library/CMakeLists.txt

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
################################################################################
2+
#
3+
# Project: openCONFIGURATOR core library
4+
#
5+
# (c) Bernecker + Rainer Industrie-Elektronik Ges.m.b.H.
6+
# B&R Strasse 1, A-5142 Eggelsberg
7+
# www.br-automation.com
8+
#
9+
# Description: CMake file for the openCONFIGURATOR core library
10+
#
11+
# License:
12+
#
13+
# Redistribution and use in source and binary forms, with or without
14+
# modification, are permitted provided that the following conditions
15+
# are met:
16+
#
17+
# 1. Redistributions of source code must retain the above copyright
18+
# notice, this list of conditions and the following disclaimer.
19+
#
20+
# 2. Redistributions in binary form must reproduce the above copyright
21+
# notice, this list of conditions and the following disclaimer in the
22+
# documentation and/or other materials provided with the distribution.
23+
#
24+
# 3. Neither the name of the copyright holders nor the names of its
25+
# contributors may be used to endorse or promote products derived
26+
# from this software without prior written permission. For written
27+
# permission, please contact [email protected].
28+
#
29+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
32+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33+
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
39+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40+
# POSSIBILITY OF SUCH DAMAGE.
41+
#
42+
# Severability Clause:
43+
#
44+
# If a provision of this License is or becomes illegal, invalid or
45+
# unenforceable in any jurisdiction, that shall not affect:
46+
# 1. the validity or enforceability in that jurisdiction of any other
47+
# provision of this License; or
48+
# 2. the validity or enforceability in other jurisdictions of that or
49+
# any other provision of this License.
50+
#
51+
################################################################################
52+
53+
PROJECT (OPEN_CONFIGURATOR_CORE_LIB)
54+
55+
###############################################################################
56+
# Set general sources and header of core library
57+
###############################################################################
58+
FILE (GLOB_RECURSE LIB_SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp")
59+
FILE (GLOB_RECURSE LIB_HEADERS "${PROJECT_SOURCE_DIR}/Include/*.h")
60+
61+
###############################################################################
62+
# Set library include directories
63+
###############################################################################
64+
IF(WIN32)
65+
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/Include/)
66+
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
67+
ELSE(WIN32)
68+
# This will cause the Boost-Headers to be included via GNU GCC's "-isystem"
69+
# option and hence will treat the Boost-Headers as system headers
70+
# (and suppress warnings for them).
71+
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/Include/)
72+
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
73+
ENDIF(WIN32)
74+
75+
###############################################################################
76+
# If DLL option is chosen library type is shared
77+
###############################################################################
78+
SET(LIBRARY_TYPE SHARED)
79+
80+
###############################################################################
81+
# Create the core library
82+
###############################################################################
83+
ADD_LIBRARY(openconfigurator_core_lib ${LIBRARY_TYPE} ${LIB_SOURCES} ${LIB_HEADERS})
84+
85+
###############################################################################
86+
# Remove lib prefix under Linux
87+
###############################################################################
88+
#IF(UNIX)
89+
# SET_TARGET_PROPERTIES(openconfigurator_core_lib PROPERTIES PREFIX "")
90+
#ENDIF()
91+
92+
###############################################################################
93+
# Link the core library
94+
###############################################################################
95+
TARGET_LINK_LIBRARIES(openconfigurator_core_lib ${ADDITIONAL_DEPENDENCIES} ${Boost_LIBRARIES})
96+
97+
###############################################################################
98+
# Install core library and dependencies to bin directory
99+
###############################################################################
100+
IF(WIN32)
101+
# Install Boost libraries
102+
FILE (GLOB BOOST_DEBUG_LIBS "${Boost_LIBRARY_DIRS}/*mt-gd*.dll")
103+
FILE (GLOB BOOST_RELEASE_LIBS "${Boost_LIBRARY_DIRS}/*mt-1*.dll")
104+
INSTALL(FILES ${BOOST_DEBUG_LIBS} DESTINATION ${INSTALL_DIR} CONFIGURATIONS Debug)
105+
INSTALL(FILES ${BOOST_RELEASE_LIBS} DESTINATION ${INSTALL_DIR} CONFIGURATIONS Release)
106+
ENDIF()
107+
108+
INSTALL(
109+
TARGETS openconfigurator_core_lib
110+
RUNTIME DESTINATION ${INSTALL_DIR}
111+
LIBRARY DESTINATION ${INSTALL_DIR}
112+
)

library/Include/AccessType.h

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/************************************************************************
2+
\file AccessType.h
3+
\brief Implementation of the Class AccessType
4+
\author rueckerc, Bernecker+Rainer Industrie Elektronik Ges.m.b.H.
5+
\date 01-May-2015 12:00:00
6+
************************************************************************/
7+
8+
/*------------------------------------------------------------------------------
9+
Copyright (c) 2015, Bernecker+Rainer Industrie-Elektronik Ges.m.b.H. (B&R)
10+
All rights reserved.
11+
Redistribution and use in source and binary forms, with or without
12+
modification, are permitted provided that the following conditions are met:
13+
* Redistributions of source code must retain the above copyright
14+
notice, this list of conditions and the following disclaimer.
15+
* Redistributions in binary form must reproduce the above copyright
16+
notice, this list of conditions and the following disclaimer in the
17+
documentation and/or other materials provided with the distribution.
18+
* Neither the name of the copyright holders nor the
19+
names of its contributors may be used to endorse or promote products
20+
derived from this software without specific prior written permission.
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
25+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
------------------------------------------------------------------------------*/
32+
#if !defined ACCESS_TYPE_H
33+
#define ACCESS_TYPE_H
34+
35+
#include <cstdint>
36+
37+
namespace IndustrialNetwork
38+
{
39+
namespace POWERLINK
40+
{
41+
namespace Core
42+
{
43+
namespace ObjectDictionary
44+
{
45+
/**
46+
\brief
47+
\author rueckerc
48+
*/
49+
enum class AccessType : std::int8_t
50+
{
51+
INVALID = -1,
52+
RW,
53+
WO,
54+
RO,
55+
CONST,
56+
RWS,
57+
WOS
58+
};
59+
60+
}
61+
62+
}
63+
64+
}
65+
66+
}
67+
#endif

0 commit comments

Comments
 (0)