git-svn-id: svn://db.shs.com.ru/pip@205 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
if (${WIN32})
|
if (WIN32)
|
||||||
find_package(MinGW REQUIRED)
|
find_package(MinGW REQUIRED)
|
||||||
find_library(PIP_LIBRARY pip ${MINGW_LIB})
|
find_library(PIP_LIBRARY pip ${MINGW_LIB})
|
||||||
set(PIP_INCLUDES ${MINGW_INCLUDE}/pip)
|
set(PIP_INCLUDES ${MINGW_INCLUDE}/pip)
|
||||||
set(PIP_CMG ${MINGW_BIN}/pip_cmg.exe)
|
set(PIP_CMG ${MINGW_BIN}/pip_cmg.exe)
|
||||||
else ()
|
else ()
|
||||||
find_library(PIP_LIBRARY pip /usr/lib/)
|
find_library(PIP_LIBRARY pip /usr/lib/)
|
||||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||||
find_library(PTHREAD_LIBRARY pthread)
|
find_library(PTHREAD_LIBRARY pthread)
|
||||||
find_library(DL_LIBRARY dl)
|
find_library(DL_LIBRARY dl)
|
||||||
list(APPEND PIP_LIBRARY ${PTHREAD_LIBRARY} ${DL_LIBRARY})
|
list(APPEND PIP_LIBRARY ${PTHREAD_LIBRARY} ${DL_LIBRARY})
|
||||||
@@ -31,12 +31,12 @@ endif ()
|
|||||||
|
|
||||||
macro (pip_code_model SRC RESULT)
|
macro (pip_code_model SRC RESULT)
|
||||||
set(RESULT "")
|
set(RESULT "")
|
||||||
set(OPTIONS "")
|
set(OPTS "")
|
||||||
set(_IS_OPT false)
|
set(_IS_OPT false)
|
||||||
foreach (_A ${ARGN})
|
foreach (_A ${ARGN})
|
||||||
#message(STATUS ${_A})
|
#message(STATUS ${_A})
|
||||||
if (_IS_OPT)
|
if (_IS_OPT)
|
||||||
set (OPTIONS ${_A})
|
set (OPTS ${_A})
|
||||||
else ()
|
else ()
|
||||||
if ("${_A}" STREQUAL "OPTIONS")
|
if ("${_A}" STREQUAL "OPTIONS")
|
||||||
set(_IS_OPT true)
|
set(_IS_OPT true)
|
||||||
@@ -47,7 +47,7 @@ macro (pip_code_model SRC RESULT)
|
|||||||
endforeach()
|
endforeach()
|
||||||
#message(STATUS "src = ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}")
|
#message(STATUS "src = ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}")
|
||||||
#message(STATUS "result = ${RESULT}")
|
#message(STATUS "result = ${RESULT}")
|
||||||
#message(STATUS "options = ${OPTIONS}")
|
#message(STATUS "options = ${OPTS}")
|
||||||
set(NEED_PARSE FALSE CACHE BOOL "NEED_PARSE" FORCE)
|
set(NEED_PARSE FALSE CACHE BOOL "NEED_PARSE" FORCE)
|
||||||
if (DEFINED CACHE_CMG_FILES)
|
if (DEFINED CACHE_CMG_FILES)
|
||||||
string(REPLACE " " ";" CMG_LIST_C "${CACHE_CMG_FILES}")
|
string(REPLACE " " ";" CMG_LIST_C "${CACHE_CMG_FILES}")
|
||||||
@@ -71,8 +71,8 @@ macro (pip_code_model SRC RESULT)
|
|||||||
endif ()
|
endif ()
|
||||||
if (NEED_PARSE)
|
if (NEED_PARSE)
|
||||||
message(STATUS "Creating code model based on \"${SRC}\", please wait ... ")
|
message(STATUS "Creating code model based on \"${SRC}\", please wait ... ")
|
||||||
#message(STATUS "exec \"-qP ${OPTIONS} -o ${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${SRC}\"")
|
#message(STATUS "exec \"-qP ${OPTS} -o ${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${SRC}\"")
|
||||||
execute_process(COMMAND ${PIP_CMG} -qP ${OPTIONS} -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC} OUTPUT_VARIABLE CMG_OUT)
|
execute_process(COMMAND ${PIP_CMG} -qP ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC} OUTPUT_VARIABLE CMG_OUT)
|
||||||
message(STATUS "Creating code model done, to use it include \"${PROJECT_NAME}_ccm.h\"")
|
message(STATUS "Creating code model done, to use it include \"${PROJECT_NAME}_ccm.h\"")
|
||||||
string(REPLACE "\n" ";" CMG_LIST "${CMG_OUT}")
|
string(REPLACE "\n" ";" CMG_LIST "${CMG_OUT}")
|
||||||
string(REPLACE "\n" " " CMG_LIST_S "${CMG_OUT}")
|
string(REPLACE "\n" " " CMG_LIST_S "${CMG_OUT}")
|
||||||
|
|||||||
@@ -76,11 +76,6 @@
|
|||||||
PIVector<PIConnection * > PIConnection::_connections;
|
PIVector<PIConnection * > PIConnection::_connections;
|
||||||
|
|
||||||
|
|
||||||
PIConnection::PIConnection(): PIObject() {
|
|
||||||
_connections << this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PIConnection::PIConnection(const PIString & name): PIObject(name) {
|
PIConnection::PIConnection(const PIString & name): PIObject(name) {
|
||||||
_connections << this;
|
_connections << this;
|
||||||
}
|
}
|
||||||
@@ -125,6 +120,7 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) {
|
|||||||
removeAllFilters();
|
removeAllFilters();
|
||||||
removeAllDevices();
|
removeAllDevices();
|
||||||
setName(name_);
|
setName(name_);
|
||||||
|
if (name_.isEmpty()) piCoutObj << "Warning, can't configure connection with empty name";
|
||||||
PIConfig::Entry ce(conf.getValue(name_));
|
PIConfig::Entry ce(conf.getValue(name_));
|
||||||
PIConfig::Branch db(ce.getValue("device").children()), fb(ce.getValue("filter").children()),
|
PIConfig::Branch db(ce.getValue("device").children()), fb(ce.getValue("filter").children()),
|
||||||
cb(ce.getValue("channel").children()), sb(ce.getValue("sender").children());
|
cb(ce.getValue("channel").children()), sb(ce.getValue("sender").children());
|
||||||
|
|||||||
@@ -32,12 +32,8 @@ class PIP_EXPORT PIConnection: public PIObject
|
|||||||
{
|
{
|
||||||
PIOBJECT_SUBCLASS(PIConnection, PIObject)
|
PIOBJECT_SUBCLASS(PIConnection, PIObject)
|
||||||
public:
|
public:
|
||||||
|
//! Constructs connection with name "name", or with default name = "connection"
|
||||||
//! Constructs an empty connection
|
PIConnection(const PIString & name = PIStringAscii("connection"));
|
||||||
PIConnection();
|
|
||||||
|
|
||||||
//! Constructs connection with name "name"
|
|
||||||
PIConnection(const PIString & name);
|
|
||||||
|
|
||||||
//! Constructs connection and configure it from config file "config" from section "name"
|
//! Constructs connection and configure it from config file "config" from section "name"
|
||||||
PIConnection(const PIString & config, const PIString & name);
|
PIConnection(const PIString & config, const PIString & name);
|
||||||
@@ -50,11 +46,11 @@ public:
|
|||||||
|
|
||||||
/*! \brief Configure connection from config file "config" from section "name". Returns if configuration was successful
|
/*! \brief Configure connection from config file "config" from section "name". Returns if configuration was successful
|
||||||
* \details \b Warning: all devices, filters and channels removed before configure! */
|
* \details \b Warning: all devices, filters and channels removed before configure! */
|
||||||
bool configureFromConfig(const PIString & config, const PIString & name);
|
bool configureFromConfig(const PIString & config, const PIString & name = PIStringAscii("connection"));
|
||||||
|
|
||||||
/*! \brief Configure connection from config content "string" from section "name". Returns if configuration was successful
|
/*! \brief Configure connection from config content "string" from section "name". Returns if configuration was successful
|
||||||
* \details \b Warning: all devices, filters and channels removed before configure! */
|
* \details \b Warning: all devices, filters and channels removed before configure! */
|
||||||
bool configureFromString(PIString * string, const PIString & name);
|
bool configureFromString(PIString * string, const PIString & name = PIStringAscii("connection"));
|
||||||
|
|
||||||
//! Returns config file section of current connection configuration
|
//! Returns config file section of current connection configuration
|
||||||
PIString makeConfig() const;
|
PIString makeConfig() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user