Changeset 185 in pacpusframework
- Timestamp:
- Oct 23, 2013, 10:32:21 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CMakeLists.txt
r175 r185 12 12 13 13 if(POLICY CMP0020) 14 cmake_policy(SET CMP0020 14 cmake_policy(SET CMP0020 NEW) # for QT5.1 on windows / not work on linux 15 15 endif() 16 16 17 # ========================================17 ################################################################################ 18 18 # Pacpus version 19 # ======================================== 20 set(PACPUS_MAJOR_VERSION 0) 21 set(PACPUS_MINOR_VERSION 1) 22 set(PACPUS_PATCH_VERSION 0) 23 set(PACPUS_VERSION 24 "${PACPUS_MAJOR_VERSION}.${PACPUS_MINOR_VERSION}.${PACPUS_PATCH_VERSION}") 19 set(${PROJECT_NAME}_MAJOR_VERSION 0) 20 set(${PROJECT_NAME}_MINOR_VERSION 1) 21 set(${PROJECT_NAME}_PATCH_VERSION 0) 22 set(${PROJECT_NAME}_VERSION 23 "${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION}") 25 24 26 # ========================================25 ################################################################################ 27 26 # CMake variables 28 # ========================================29 27 set(PACPUS_ROOT_DIR ${CMAKE_SOURCE_DIR}) 30 28 set(PACPUS_3RD_PARTY_DIR ${PACPUS_ROOT_DIR}/3rd) 31 29 set(PACPUS_CMAKE_DIR ${PACPUS_ROOT_DIR}/cmake) 32 30 set(PACPUS_DOC_DIR ${PACPUS_ROOT_DIR}/doc) 31 set(PACPUS_EXAMPLES_DIR ${PACPUS_ROOT_DIR}/examples) 33 32 set(PACPUS_INCLUDE_DIR ${PACPUS_ROOT_DIR}/include/) 34 33 set(PACPUS_SCRIPTS_DIR ${PACPUS_ROOT_DIR}/scripts) … … 36 35 set(IS_BUILDING_PACPUS TRUE) 37 36 38 # ========================================37 ################################################################################ 39 38 # Configure CMake 40 # ========================================41 39 list(APPEND CMAKE_MODULE_PATH ${PACPUS_CMAKE_DIR}) 42 40 43 # ========================================41 ################################################################################ 44 42 # Import some functions 45 # ========================================46 43 include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake) 47 44 48 # ========================================45 ################################################################################ 49 46 # Configure Pacpus 50 # ========================================51 47 include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake) 52 48 53 # ========================================49 ################################################################################ 54 50 # Find dependencies 55 # ========================================56 51 include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake) 57 52 58 # ========================================53 ################################################################################ 59 54 # Handle platform-specific behaviour 60 # ========================================61 55 include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake) 62 56 63 # ========================================57 ################################################################################ 64 58 # Compiler flags coming from PacpusDependencies and PacpusPlatforms 65 # ========================================66 59 #message(STATUS "\${PACPUS_DEFINITIONS} = ${PACPUS_DEFINITIONS}") 67 60 add_definitions(${PACPUS_DEFINITIONS}) 68 61 69 # ======================================== 70 # Pre-configuration of the compiler 71 # ======================================== 62 ################################################################################ 72 63 # Includes directories 73 64 include_directories( … … 76 67 ) 77 68 78 # ========================================69 ################################################################################ 79 70 # Build the Pacpus' modules 80 # ========================================81 71 add_subdirectory(${PACPUS_SOURCE_DIR}) 82 if(PACPUS_BUILD_EXAMPLES)83 add_subdirectory(examples)84 endif()85 72 86 # ======================================== 87 # Build the documentation if enabled 88 # ======================================== 73 ################################################################################ 74 # DOCUMENTATION 89 75 if(PACPUS_BUILD_DOC) 90 76 add_subdirectory(${PACPUS_DOC_DIR}) 91 77 endif() 92 78 93 # ========================================79 ################################################################################ 94 80 # Pacpus Installation 95 # ========================================96 81 include(${PACPUS_CMAKE_DIR}/PacpusInstall.cmake) 97 82 set(ENV{PACPUS_ROOT} ${PACPUS_INSTALL_DIR}) 98 83 99 # ======================================== 100 # Summary 101 # ======================================== 84 ################################################################################ 85 # EXAMPLES 86 if(PACPUS_BUILD_EXAMPLES) 87 add_subdirectory(${PACPUS_EXAMPLES_DIR}) 88 endif() 89 90 ################################################################################ 91 # SUMMARY 102 92 pacpus_info("") 103 93 pacpus_info("=====================================================================") 104 pacpus_info("Configuration for Pacpus ${ PACPUS_VERSION}")94 pacpus_info("Configuration for Pacpus ${${PROJECT_NAME}_VERSION}") 105 95 pacpus_info("=====================================================================") 106 96 pacpus_info("") -
trunk/cmake/PacpusInstall.cmake
r89 r185 8 8 ################################################# 9 9 10 # ======================================== 11 # CMake files 12 # ======================================== 10 ################################################################################ 11 # CMake 13 12 install( 14 13 DIRECTORY … … 18 17 ) 19 18 20 # ======================================== 21 # Include files 22 # ======================================== 19 ################################################################################ 20 # INCLUDES 23 21 install( 24 22 DIRECTORY … … 28 26 ) 29 27 30 # ========================================28 ################################################################################ 31 29 # Installation of the 3rd party 32 # ========================================33 30 if(PACPUS_INSTALL_3RD) 34 31 install( … … 40 37 endif() 41 38 42 # ========================================39 ################################################################################ 43 40 # Installation of the documentation 44 # ========================================45 41 if(PACPUS_BUILD_DOC) 46 42 install( -
trunk/examples/ProducerConsumerExample/CMakeLists.txt
r181 r185 1 1 project(ProducerConsumerExample) 2 2 3 # ========================================4 # Basic Definitions5 # ========================================6 3 set(${PROJECT_NAME}_VERSION_MAJOR 0) 7 4 set(${PROJECT_NAME}_VERSION_MINOR 1) 8 5 6 ################################################################################ 9 7 create_export(EXPORT_HDR ${PROJECT_NAME}) 10 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME})8 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 11 9 12 # ======================================== 13 # Compiler definitions 14 # ======================================== 15 add_definitions(${QT_DEFINITIONS}) 16 17 # ======================================== 18 # Include directories 19 # ======================================== 10 ################################################################################ 11 # INCLUDES 20 12 include_directories( 21 13 ${PACPUSCITYVIP_INCLUDE_DIR} … … 24 16 ) 25 17 26 # ========================================18 ################################################################################ 27 19 # Link directories 28 # ========================================29 20 set(SRC_BINARY_DIR "${PROJECT_BINARY_DIR}/../../src") 30 21 get_filename_component(SRC_BINARY_DIR "${SRC_BINARY_DIR}" ABSOLUTE) … … 36 27 ) 37 28 38 # ======================================== 39 # List of sources 40 # ======================================== 29 ################################################################################ 30 # FILES 41 31 set(PROJECT_HDRS 32 ${EXPORT_HDR} 42 33 ProducerExample.h 43 34 ConsumerExample.h 44 ${PROJECT_NAME}.xml45 ${EXPORT_HDR}35 XML/${PROJECT_NAME}.xml 36 XML/${PROJECT_NAME}_d.xml 46 37 ) 47 38 set(PROJECT_SRCS … … 51 42 ) 52 43 53 # ========================================54 # Files to MOC55 # ========================================56 44 set(FILES_TO_MOC 57 ${PLUGIN_H }45 ${PLUGIN_HDR} 58 46 ProducerExample.h 59 47 ConsumerExample.h … … 63 51 ) 64 52 65 # ======================================== 66 # Call MOC 67 # ======================================== 68 qt_wrap_cpp( 69 PROJECT_MOC_SRCS 53 ################################################################################ 54 # Qt: call moc, uic 55 qt_wrap_cpp(PROJECT_MOC_SRCS 70 56 ${FILES_TO_MOC} 71 57 ) 72 58 73 qt_wrap_ui( 74 PROJECT_UI_SRCS 59 qt_wrap_ui(PROJECT_UI_SRCS 75 60 ${UI_FILES} 76 61 ) 77 62 78 # ======================================== 79 # Build a library 80 # ======================================== 81 pacpus_add_library( 82 ${PROJECT_NAME} SHARED 63 ################################################################################ 64 # BUILD and LINK 65 pacpus_add_library(${PROJECT_NAME} SHARED 83 66 ${PROJECT_HDRS} 84 67 ${PROJECT_SRCS} … … 86 69 ${PROJECT_UI_SRCS} 87 70 ) 71 88 72 list(APPEND PACPUS_LIBRARIES 89 73 optimized PacpusLib debug PacpusLib_d 90 74 ) 91 if(WIN32) 92 list(APPEND PACPUS_LIBRARIES 93 optimized road_time debug road_time_d 94 ) 95 endif() 96 #message("\${PACPUS_LIBRARIES} = ${PACPUS_LIBRARIES}") 97 #message("\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}") 98 99 # ======================================== 100 # Libraries 101 # ======================================== 102 # All the platform 103 target_link_libraries(${PROJECT_NAME} 75 message(STATUS "\${PACPUS_LIBRARIES} = ${PACPUS_LIBRARIES}") 76 message(STATUS "\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}") 77 # LIBS 78 set(LIBS 104 79 ${PACPUS_LIBRARIES} 105 80 ${PACPUS_DEPENDENCIES_LIB} 81 #${OpenCV_LIBRARIES} 106 82 ${QT_LIBRARIES} 107 #${OpenCV_LIBRARIES}108 83 ) 109 84 110 # ======================================== 111 # Install 112 # ======================================== 85 # LINK 86 target_link_libraries(${PROJECT_NAME} ${LIBS}) 87 88 ################################################################################ 89 # FOLDERS 90 pacpus_folder(${PROJECT_NAME} "examples") 91 92 ################################################################################ 93 # INSTALL 113 94 pacpus_install(${PROJECT_NAME}) 114 95 115 96 # Installation of the headers 116 97 #install(DIRECTORY ${PACPUSCITYVIP_INCLUDE_DIR} DESTINATION "${PACPUS_ROOT}") 117 118 # ========================================119 # Folder120 # ========================================121 pacpus_folder(${PROJECT_NAME} "examples") -
trunk/include/Pacpus/kernel/InputOutputBase.h
r182 r185 66 66 virtual ~InputInterfaceBase(); 67 67 68 virtual void customEvent(QEvent * e);68 virtual void customEvent(QEvent * e); 69 69 70 70 ReadingMode & readingMode(); 71 const ReadingMode & readingMode() const;71 const ReadingMode & getReadingMode() const; 72 72 void setReadingMode(ReadingMode mode); 73 73 … … 96 96 QStringList getInputConnectedList(); 97 97 98 // TODO for serialization prupose (not yet implemented !!!)99 98 void send(/*const*/ QByteArray & data); 100 99 }; 101 102 namespace {103 104 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast);105 106 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode)107 {108 if (out->getDataType() == in->getDataType() || out->getDataType() == QString(typeid(QByteArray).name()) || in->getDataType() == QString(typeid(QByteArray).name())) {109 // Add connection110 out->addConnection(ConnectionBase(in, priority)); // TODO make connect function111 in->addConnection(ConnectionBase(out, priority));112 in->setReadingMode(mode);113 //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature());114 return true;115 } else {116 //LOG_WARN("connecting " << out->getSignature() << ":" << out->getDataType() << " to " << in->getSignature() << ":" << in->getDataType() << " failled : DataType incompatible " << QString(typeid(QByteArray).name()));117 return false;118 }119 }120 121 } // namespace122 100 123 101 } // namespace pacpus -
trunk/include/Pacpus/kernel/InputOutputInterface.h
r184 r185 96 96 97 97 // TODO for Pulling mode (not yet implemented !!!) 98 T & getData() {98 T & getData() { 99 99 T data; 100 100 // TODO ask output data; … … 105 105 protected: 106 106 void (C::*method)(const T&); 107 108 107 }; 109 108 110 109 template <typename T, class C> 111 class OutputInterface : public OutputInterfaceBase 110 class OutputInterface 111 : public OutputInterfaceBase 112 112 { 113 113 public: 114 114 OutputInterface(QString name, C * component) 115 : OutputInterfaceBase(name,component,component)115 : OutputInterfaceBase(name, component, component) 116 116 {} 117 117 ~OutputInterface() {} … … 120 120 void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0); 121 121 122 void send(const T & data, road_time_t t, road_timerange_t tr)123 {124 // FIXME Data Shared125 //QSharedPointer<T> sharedPointer = new T(data);126 127 for (QList<ConnectionBase>::iterator it = connections().begin(); it != connections().end(); ++it) {128 QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data,t,tr),it->getPriority()); // Event is delete by the event loop handler129 //qDebug() << "sender " << it->getInterface()->getSignature() << " thread " << QThread::currentThread() << " Data & " << &data << " ";130 }131 }132 133 122 size_t getDataSize() 134 123 { … … 142 131 }; 143 132 133 template <typename T, class C> 134 void OutputInterface<T, C>::send(const T & data, road_time_t t, road_timerange_t tr) 135 { 136 // FIXME Data Shared 137 //QSharedPointer<T> sharedPointer = new T(data); 138 139 for (QList<ConnectionBase>::iterator it = connections().begin(); it != connections().end(); ++it) { 140 QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data,t,tr),it->getPriority()); // Event is delete by the event loop handler 141 //qDebug() << "sender " << it->getInterface()->getSignature() << " thread " << QThread::currentThread() << " Data & " << &data << " "; 142 } 143 } 144 144 145 } // namespace pacpus 145 146 -
trunk/src/PacpusLib/CMakeLists.txt
r182 r185 11 11 create_export(EXPORT_HDR ${PROJECT_NAME} "${PACPUS_INCLUDE_DIR}/Pacpus/kernel") 12 12 13 # ======================================== 14 # Configure qt4 15 # ======================================== 16 #if(QT4_FOUND) 17 # set(QT_USE_QTXML true) 18 # include(${QT_USE_FILE}) 19 #else() 20 # message(ERROR "Qt4 needed") 21 #endif() 22 23 24 # ======================================== 25 # Compiler definitions 26 # ======================================== 13 ################################################################################ 27 14 add_definitions( 28 15 -DQT_NO_KEYWORDS … … 30 17 ) 31 18 32 # ======================================== 33 # Include directories 34 # ======================================== 19 ################################################################################ 20 # INCLUDES 35 21 include_directories( 36 22 ${QT_INCLUDE_DIR} 37 23 ) 38 24 39 # ======================================== 40 # Link directories 41 # ======================================== 25 ################################################################################ 26 # LINK 42 27 link_directories( 43 28 ${PROJECT_BINARY_DIR}/../RoadTime … … 45 30 ) 46 31 47 # ======================================== 48 # List of sources 49 # ======================================== 32 ################################################################################ 33 # FILES 50 34 set(PROJECT_HDRS 51 35 ${EXPORT_HDR} 36 52 37 ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/cstdint.h 53 38 ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/ComponentBase.h … … 89 74 ) 90 75 91 qt_wrap_cpp( 92 PROJECT_MOC_SRCS 93 ${FILES_TO_MOC} 94 ) 95 96 # ======================================== 97 # Build a library 98 # ======================================== 76 qt_wrap_cpp(PROJECT_MOC_SRCS 77 ${FILES_TO_MOC} 78 ) 79 80 ################################################################################ 81 # BUILD AND LINK 99 82 pacpus_add_library(${PROJECT_NAME} SHARED 100 83 ${PROJECT_HDRS} … … 109 92 endif() 110 93 111 # ======================================== 112 # Libraries 113 # ======================================== 94 ################################################################################ 95 # LIBS 114 96 target_link_libraries( 115 97 ${PROJECT_NAME} … … 119 101 ) 120 102 121 # ======================================== 122 # Install 123 # ======================================== 103 ################################################################################ 104 # INSTALL 124 105 pacpus_install(${PROJECT_NAME}) 125 106 126 # ======================================== 127 # Folder 128 # ======================================== 107 ################################################################################ 108 # FOLDER 129 109 pacpus_folder(${PROJECT_NAME} "libraries") -
trunk/src/PacpusLib/ComponentManager.cpp
r184 r185 18 18 19 19 DECLARE_STATIC_LOGGER("pacpus.core.ComponentManager"); 20 21 //////////////////////////////////////////////////////////////////////////////// 22 23 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast); 24 25 //////////////////////////////////////////////////////////////////////////////// 26 27 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode) 28 { 29 if (out->getDataType() == in->getDataType() || out->getDataType() == QString(typeid(QByteArray).name()) || in->getDataType() == QString(typeid(QByteArray).name())) { 30 // Add connection 31 out->addConnection(ConnectionBase(in, priority)); // TODO make connect function 32 in->addConnection(ConnectionBase(out, priority)); 33 in->setReadingMode(mode); 34 //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature()); 35 return true; 36 } else { 37 //LOG_WARN("connecting " << out->getSignature() << ":" << out->getDataType() << " to " << in->getSignature() << ":" << in->getDataType() << " failled : DataType incompatible " << QString(typeid(QByteArray).name())); 38 return false; 39 } 40 } 41 42 //////////////////////////////////////////////////////////////////////////////// 20 43 21 44 ComponentManager * ComponentManager::mInstance = NULL; -
trunk/src/PacpusLib/InputOutputBase.cpp
r182 r185 97 97 } 98 98 99 const InputInterfaceBase::ReadingMode & InputInterfaceBase:: readingMode() const99 const InputInterfaceBase::ReadingMode & InputInterfaceBase::getReadingMode() const 100 100 { 101 101 return m_readingMode;
Note:
See TracChangeset
for help on using the changeset viewer.