├── README.md
├── _config.yml
├── samples
├── c++
│ ├── CMakeLists.txt
│ ├── cmake
│ │ └── FindPoco.cmake
│ ├── include
│ │ ├── json.h
│ │ └── ppe.h
│ └── src
│ │ ├── json.cpp
│ │ ├── main.cpp
│ │ └── ppe.cpp
└── python
│ └── sample.py
└── whitepaper
├── cortexica_whitepaper_realtime_ppe_monitoring_edge.pdf
└── images
├── access_control.jpg
├── arch.jpg
├── continuous_monitoring.png
├── iotswc.JPG
├── myriad-x.jpg
├── myriad-x.png
├── pharma-ppe.jpg
├── ppe-rrk.jpg
├── sample.png
└── stats.png
/README.md:
--------------------------------------------------------------------------------
1 | # Real-time PPE Monitoring on the Edge
2 | powered by the latest ultra-low-power high-performance [Intel Myriad X VPU](https://www.movidius.com/myriadx)
3 |
4 | [Martin Peniak, PhD](http://www.martinpeniak.com) — [Innovation Department](https://www.cortexica.com/research-innovation/)
5 | martin@cortexica.com
6 |
7 | ## Abstract
8 | Personal Protective Equipment (PPE) is the equipment that protects the user against health or safety risks. Not wearing PPE dramatically increases the chances of injuries and in many situations also of financial losses due to fines for injuries and death of workers as well as contamination caused by not wearing gloves, hairnets, shoe covers, etc. Recent advancements in edge computing hardware coupled with ever more efficient software have enabled novel solutions with the potential to prevent injuries, save lives as well as money and time. This document describes the world’s first edge compute solution for PPE ingress and real- time PPE compliance monitoring.
9 |
10 |
11 |
12 |
13 |
14 | ## Introduction
15 | Cortexica has been at the forefront of the machine vision revolution. We have reverse-engineered parts of the human visual cortex, which allowed us to develop a powerful image search engine nowadays widely used to solve many real-world problems. Partnering with various world-leading businesses allows us to identify numerous real-world problems that can be addressed by applying machine vision methods. Some of the solutions to these problems are often very specific while others are widely applicable and have the potential to save lives. Probably the best example of this is our family of solutions designed for PPE ingress and real-time PPE compliance monitoring (see Figures 1 and 2).
16 |
17 | PPE is designed to protect users from serious injuries or illnesses resulting from a physical, mechanical, electrical, chemical or radiological contact. The importance of PPE is paramount because it serves as the last line of defence against an injury or death. Unfortunately, studies have demonstrated that 98% of workers said they have seen others not wearing PPE when they should have been and 30% of those said this happens regularly. Head injuries, constituting 9% of all injuries, can be fatal and yet 84% of these were caused by not wearing a helmet [1]. Most of these injuries could have been prevented had there been a system in place that would continuously monitor for PPE compliance.
18 |
19 | Recent advancements in edge computing gave raise to novel applications designed to process data right at its source effectively minimising latency and allowing real-time processing. This paper presents a solution for PPE ingress and compliance monitoring that runs in real-time and entirely on the edge.
20 |
21 |
22 |
23 |
24 |
25 | *Fig.1 - Cortexica PPE ingress solution installed at Axis Experience Centre, Madrid. This solution detects if a person is wearing a helmet and a high visibility jacket. A person is only allowed to enter a workplace once all the PPE checks have been approved.*
26 |
27 |
28 |
29 |
30 |
31 | *Fig.2 - Cortexica real-time PPE compliance monitoring solution installed at Axis Experience Centre, Madrid. This solution is continuously scanning workplace and raises an alarm if a person is not wearing a helmet and a high visibility jacket. The scanning is done using Axis pan/tilt/zoom (PTZ) camera and Axis radar capable of detecting motion within 50 meters range. The radar detects motion and then automatically moves the camera to the point of interest.*
32 |
33 |
34 |
35 |
36 |
37 | *Fig.3 - Cortexica PPE ingress solution designed for a pharmaceutical company. This solution detects if an employee is wearing boots, overall, gloves, hairnet, beardnet, head cover and transparent glasses. An employee is only allowed to enter a workplace once all the PPE checks have been approved.*
38 |
39 |
40 |
41 |
42 |
43 | *Fig.4 - Cortexica was the first and only company to present a working demonstration utilising the latest Intel Myriad X VPU. This image shows one of our AI Safety (PPE) demos at the Intel booth. The second demo was installed at AAEON (Asus asoc.) stand.*
44 |
45 | ## Development Kit Overview
46 | It takes more than algorithms to deliver an AI driven product that solves a real-life problem. Working in partnership with UP we have developed UP Squared AI Edge-PPE monitoring, a development kit (see Figure 5) for health and safety professionals to create proof of concepts (POC) to full blown AI applications ready for live deployment. The development kit offers the following:
47 |
48 | * Real-time video analysis with advanced algorithms and machine learning to ensure employees are wearing the correct PPE for their working environment
49 | * Parallel detection of PPE, Face, Person, and Body parts leveraging CPU, GPU and VPU processors
50 | * Powered by the latest ultra-low-power high-performance Intel Myriad X VPU (see Figures 6 and 7)
51 | * Single image mode
52 | * Real-time mode
53 | * Made for POCs
54 |
55 |
56 |
57 |
58 |
59 | *Fig.5 - The PPE monitoring development kit is available to purchase as an off-the-shelf solution, complete with hardware and software configuration, and detailed step-by-step guides to help you start prototyping your next AI monitoring or video surveillance project. For health and safety professions, this development kit assists the creation of a PPE monitoring system, and for industries at large, an AI driven surveillance application.*
60 |
61 |
62 |
63 |
64 |
65 | *Fig.6 - The AI CORE X is powered by the recently released Intel® Movidius Myriad X, a third-generation vision processing unit (VPU) that is the first in its class to include a Neural Compute Engine – a dedicated hardware accelerator for deep neural networks, trainable with industry-standard tools.*
66 |
67 |
68 |
69 |
70 |
71 | *Fig.7 - Myriad™X features the all-new Neural Compute Engine - a purpose-built hardware accelerator designed to dramatically increase performance of deep neural networks without compromising the low power characteristics of the Myriad VPU product line. Featuring an array of MAC blocks and directly interfacing with the intelligent memory fabric, the Neural Compute Engine is able to rapidly perform the calculations necessary for deep inference without hitting the so-called "data wall" bottleneck encountered by other processor designs. Combining the neural network performance of the 16 proprietary SHAVE cores with the neural compute engine, Myriad X delivers 10X the performance compared to previous generations.*
72 |
73 | ## Software
74 | This section provides a detailed description of the software architecture, its components and their integration through the REST API.
75 |
76 |
77 |
78 |
79 |
80 | *Fig.8 - Software architecture diagram showing the PPE service and the demo sample. The PPE service receives an image and a JSON specifying simple options and returns a JSON with detection results containing bounding boxes, corresponding object classes and the time in milliseconds that it took to run a single inference.*
81 |
82 | ### PPE Service
83 | The PPE service is a C++ application running a HTTP server with a REST API. This service is able to run inference on multiple deep learning models in parallel on all the available CPU, GPU and VPU processors to obtain the results in the shortest time possible. The service starts automatically running after the operating system is initialised and then continues running on the port 8081. The REST API has the following endpoints that can be used to interact with the service:
84 |
85 | * **/ppe** – single image mode allowing maximum of 30 requests followed by 90 seconds timeout
86 | * **/continuous-ppe** – continuous mode allowing unlimited number of images within 60 seconds followed by 90 seconds timeout
87 |
88 | Both endpoints accept multipart/form-data POST requests containing an image and a JSON specifying the query options. For example the following JSON options example enables all the four models with thresholds set to 60% confidence. The threshold parameters are optional and if no threshold is set then the default value of 50% confidence will be applied.
89 |
90 | ```javascript
91 | {
92 | “detectPPE”: true,
93 | “detectFaces”: true,
94 | “detectPersons”: true,
95 | “detectBodyParts”: true,
96 | “ppeThreshold”: 0.6,
97 | “faceThreshold”: 0.6,
98 | “personThreshold”: 0.6,
99 | “bodyPartsThreshold”: 0.6
100 | }
101 | ```
102 |
103 | Since the PPE service provides the REST interface the integration with your own application is very easy and can be also done accross the network. The sample application described in the next section shows how to achieve this integration using C++ but you can use any programming language or method. For example, here is a curl request code:
104 |
105 | ```shell
106 | curl
107 | −−request POST
108 | −−url http://localhost:8081/ppe
109 | −−header ’content−type:multipart/form−data; boundary=−−−−WebKitFormBoundary’
110 | −−form’ options={
111 | “detectPPE “ : true,
112 | “detectFaces “ : true,
113 | “detectPersons “ : true,
114 | “detectBodyParts “ : true,
115 | “ppeThreshold “ : 0.6,
116 | “faceThreshold “ : 0.6,
117 | “personThreshold “ : 0.6,
118 | “bodyPartsThreshold “ : 0.6}’
119 | −−form image=@example.png
120 | ```
121 |
122 | The following snipped shows a JSON results example:
123 |
124 | ```javascript
125 | {
126 | "ms": 49,
127 | "result": [
128 | {
129 | "categoryClass": "vest",
130 | "confidence": 0.92055,
131 | "xEnd": 0.82968,
132 | "xStart": 0.4789,
133 | "yEnd": 0.99027,
134 | "yStart": 0.36382
135 | },
136 | {
137 | "categoryClass": "helmet",
138 | "confidence": 0.95361,
139 | "xEnd": 0.74687,
140 | "xStart": 0.58749,
141 | "yEnd": 0.21527,
142 | "yStart": 0.03449
143 | },
144 | {
145 | "categoryClass": "face",
146 | "confidence": 1,
147 | "xEnd": 0.92653,
148 | "xStart": 0.61093,
149 | "yEnd": 0.41527,
150 | "yStart": 0.13194
151 | }
152 | ],
153 | "status": 0
154 | }
155 | ```
156 |
157 | where **ms** is inference time in milliseconds, **categoryClass** is the class of the detected object, confidence is the detection confidence level (e.g. 0.95 =95% confidence) and **xStart**, **xEnd**, **yStart**, **yEnd** define the bounding boxes of the detected object. When multiplied with the image dimensions, pixel coordinates can be obtained. For example, a bounding box in OpenCV can be created using:
158 |
159 | ```
160 | cv::Rect rect(cv::Point(xStart * width, yStart * height), cv::Point(xEnd * width, yEnd * height))
161 | ```
162 |
163 | ### PPE Demo Sample
164 | This sample application was written in C++ to demonstrate how to send queries to and receive results from the PPE service via the REST API. The application source code is located under /home/upsquared/cortexica/sample/ and the compiled binary under the bin subdirectory. The application depends only on OpenCV and Poco libraries. To compile the sample run the following commands:
165 |
166 | ```shell
167 | $ cd /home/upsquared/cortexica/sample/
168 | $ mkdir build
169 | $ cd build
170 | $ source /opt/intel/computer_vision_sdk/bin/setupvars.sh
171 | $ cmake ..
172 | $ make
173 | ```
174 |
175 | You can run the application using as follows:
176 |
177 | ```shell
178 | $ bin/sample
179 | ```
180 | Here is an example of sample application front-end showing the detection results plotted as bounding boxes. The four sliders at the top are used to adjust the sensitivity of the models or to turn them off completely.
181 |
182 |
183 |
184 |
185 |
186 | ### License and Limitations
187 | The development kit has been primarily designed to enable the evaluation of our technology and to facilitate seamless integration with other applications with the goal of creating POCs. If a client is satisfied with the POC and wants to use it for commercial purposes then the client should contact us to obtain a license and a production grade software with models optimised for that specific use case. As a consequence, using this development kit for commercial purposes is prohibited. The following measures have been implemented to prevent unauthorised use of this development kit:
188 |
189 | * The PPE service will expire in one year from its first use
190 | * Models have been encrypted to prevent unauthorised use
191 | * Single image mode is restricted to a maximum of 30 consecutive requests
192 | * There is a 90 seconds time out afterwards during which no requests can be made
193 | * Additional requests can be made after this time out has finished
194 | * Real-time mode allows unlimited number of frames within a 60 seconds period
195 | * There is a 90 seconds time out after these 20 seconds during which no requests can be made
196 | * Additional requests can be made after this time out has finished
197 |
198 | ## Videos
199 | * [AI-Safe](https://vimeo.com/333964736)
200 | * [PPE Ingress](https://vimeo.com/cortexica/ingressconstruction)
201 | * [PPE Continuous Monitoring](https://vimeo.com/cortexica/continuousmonitoringradar)
202 | * [Artificial Intelligence on the Edge - Safety](https://player.vimeo.com/video/297960010)
203 |
204 | ## References
205 | [1] U.S. Department of Labor, Bureau of Labor Statistics, Accidents Involving Head Injuries, Report 605, (Washington, D.C., Government Printing Office, July 1980) p. 1
206 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
2 |
--------------------------------------------------------------------------------
/samples/c++/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.2)
2 |
3 | project(sample)
4 |
5 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
6 |
7 | find_package(OpenCV REQUIRED)
8 | find_package(Poco REQUIRED COMPONENTS Foundation Net NetSSL Util)
9 |
10 | set(CMAKE_BUILD_TYPE Release)
11 | set(CMAKE_CXX_FLAGS_RELEASE "-O3")
12 | set(CMAKE_CXX_STANDARD 14)
13 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
14 |
15 | FILE(GLOB INCLUDES include/*.h)
16 | FILE(GLOB SOURCES src/*.cpp)
17 |
18 | source_group("Header Files" FILES ${INCLUDES})
19 | source_group("Source Files" FILES ${SOURCES})
20 |
21 | add_executable(${PROJECT_NAME} ${INCLUDES} ${SOURCES})
22 |
23 | include_directories(${PROJECT_SOURCE_DIR}/include)
24 |
25 | target_link_libraries(${PROJECT_NAME} ${Poco_LIBRARIES} ${OpenCV_LIBS})
26 | install(TARGETS ${PROJECT_NAME} DESTINATION /home/upsquared/cortexica/samples/c++/bin/)
27 |
--------------------------------------------------------------------------------
/samples/c++/cmake/FindPoco.cmake:
--------------------------------------------------------------------------------
1 | # - Find the Poco includes and libraries.
2 | # The following variables are set if Poco is found. If Poco is not
3 | # found, Poco_FOUND is set to false.
4 | # Poco_FOUND - True when the Poco include directory is found.
5 | # Poco_INCLUDE_DIRS - the path to where the poco include files are.
6 | # Poco_LIBRARY_DIR - The path to where the poco library files are.
7 | # Poco_BINARY_DIRS - The path to where the poco dlls are.
8 | # Poco_LIBRARIES - list of all libs from requested components.
9 |
10 | # ----------------------------------------------------------------------------
11 | # If you have installed Poco in a non-standard location.
12 | # Then you have three options.
13 | # In the following comments, it is assumed that
14 | # points to the root directory of the include directory of Poco. e.g
15 | # If you have put poco in C:\development\Poco then is
16 | # "C:/development/Poco" and in this directory there will be two
17 | # directories called "include" and "lib".
18 | # 1) After CMake runs, set Poco_INCLUDE_DIR to /poco<-version>
19 | # 2) Use CMAKE_INCLUDE_PATH to set a path to /poco<-version>. This will allow FIND_PATH()
20 | # to locate Poco_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g.
21 | # SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/include")
22 | # 3) Set an environment variable called ${POCO_ROOT} that points to the root of where you have
23 | # installed Poco, e.g. . It is assumed that there is at least a subdirectory called
24 | # Foundation/include/Poco in this path.
25 | #
26 | # Note:
27 | # 1) If you are just using the poco headers, then you do not need to use
28 | # Poco_LIBRARY_DIR in your CMakeLists.txt file.
29 | # 2) If Poco has not been installed, then when setting Poco_LIBRARY_DIR
30 | # the script will look for /lib first and, if this fails, then for /stage/lib.
31 | #
32 | # Usage:
33 | # In your CMakeLists.txt file do something like this:
34 | # ...
35 | # # Poco
36 | # FIND_PACKAGE(Poco COMPONENTS XML Net Data...)
37 | # ...
38 | # INCLUDE_DIRECTORIES(${Poco_INCLUDE_DIRS})
39 | # LINK_DIRECTORIES(${Poco_LIBRARY_DIR})
40 | #
41 | # In Windows, we make the assumption that, if the Poco files are installed, the default directory
42 | # will be C:\poco or C:\Program Files\Poco or C:\Programme\Poco.
43 |
44 | MESSAGE(STATUS "Searching for Poco library...")
45 |
46 | SET(POCO_INCLUDE_PATH_DESCRIPTION "top-level directory containing the poco include directories. E.g /usr/local/include/ or c:\\poco\\include\\poco-1.3.2")
47 | SET(POCO_INCLUDE_DIR_MESSAGE "Set the Poco_INCLUDE_DIR cmake cache entry to the ${POCO_INCLUDE_PATH_DESCRIPTION}")
48 | SET(POCO_LIBRARY_PATH_DESCRIPTION "top-level directory containing the poco libraries.")
49 | SET(POCO_LIBRARY_DIR_MESSAGE "Set the Poco_LIBRARY_DIR cmake cache entry to the ${POCO_LIBRARY_PATH_DESCRIPTION}")
50 |
51 |
52 | SET(POCO_DIR_SEARCH $ENV{POCO_ROOT})
53 | IF(POCO_DIR_SEARCH)
54 | FILE(TO_CMAKE_PATH ${POCO_DIR_SEARCH} POCO_DIR_SEARCH)
55 | ENDIF(POCO_DIR_SEARCH)
56 |
57 |
58 | IF(WIN32)
59 | SET(POCO_DIR_SEARCH
60 | ${POCO_DIR_SEARCH}
61 | C:/poco
62 | D:/poco
63 | "C:/Program Files/poco"
64 | "C:/Programme/poco"
65 | "D:/Program Files/poco"
66 | "D:/Programme/poco"
67 | )
68 | ENDIF(WIN32)
69 |
70 | # Add in some path suffixes. These will have to be updated whenever a new Poco version comes out.
71 | SET(SUFFIX_FOR_INCLUDE_PATH
72 | poco-1.3.2
73 | poco-1.3.3
74 | poco-1.3.4
75 | poco-1.3.5
76 | poco-1.3.6
77 | )
78 |
79 | SET(SUFFIX_FOR_LIBRARY_PATH
80 | poco-1.3.2/lib
81 | poco-1.3.2/lib/Linux/i686
82 | poco-1.3.2/lib/Linux/x86_64
83 | poco-1.3.3/lib
84 | poco-1.3.3/lib/Linux/i686
85 | poco-1.3.3/lib/Linux/x86_64
86 | poco-1.3.4/lib
87 | poco-1.3.4/lib/Linux/i686
88 | poco-1.3.4/lib/Linux/x86_64
89 | poco-1.3.5/lib
90 | poco-1.3.5/lib/Linux/i686
91 | poco-1.3.5/lib/Linux/x86_64
92 | poco-1.3.6/lib
93 | poco-1.3.6/lib/Linux/i686
94 | poco-1.3.6/lib/Linux/x86_64
95 | lib
96 | lib/Linux/i686
97 | lib/Linux/x86_64
98 | )
99 |
100 | #
101 | # Look for an installation.
102 | #
103 | FIND_PATH(Poco_INCLUDE_DIR NAMES Foundation/include/Poco/SharedLibrary.h PATH_SUFFIXES ${SUFFIX_FOR_INCLUDE_PATH} PATHS
104 |
105 | # Look in other places.
106 | ${POCO_DIR_SEARCH}
107 |
108 | # Help the user find it if we cannot.
109 | DOC "The ${POCO_INCLUDE_PATH_DESCRIPTION}"
110 | )
111 |
112 | IF(NOT Poco_INCLUDE_DIR)
113 |
114 | # Look for standard unix include paths
115 | FIND_PATH(Poco_INCLUDE_DIR Poco/Poco.h DOC "The ${POCO_INCLUDE_PATH_DESCRIPTION}")
116 |
117 | ENDIF(NOT Poco_INCLUDE_DIR)
118 |
119 | # Assume we didn't find it.
120 | SET(Poco_FOUND 0)
121 |
122 | # Now try to get the include and library path.
123 | IF(Poco_INCLUDE_DIR)
124 | IF(EXISTS "${Poco_INCLUDE_DIR}/Foundation/include/Poco/SharedLibrary.h")
125 | SET(Poco_INCLUDE_DIRS
126 | ${Poco_INCLUDE_DIR}/CppUnit/include
127 | ${Poco_INCLUDE_DIR}/Foundation/include
128 | ${Poco_INCLUDE_DIR}/Net/include
129 | ${Poco_INCLUDE_DIR}/Util/include
130 | ${Poco_INCLUDE_DIR}/XML/include
131 | )
132 | SET(Poco_FOUND 1)
133 | ELSEIF(EXISTS "${Poco_INCLUDE_DIR}/Poco/Poco.h")
134 | SET(Poco_INCLUDE_DIRS
135 | ${Poco_INCLUDE_DIR}
136 | )
137 | SET(Poco_FOUND 1)
138 | ENDIF()
139 |
140 | IF(NOT Poco_LIBRARY_DIR)
141 |
142 | FIND_LIBRARY(Poco_FOUNDATION_LIB NAMES PocoFoundation PocoFoundationd PATH_SUFFIXES ${SUFFIX_FOR_LIBRARY_PATH} PATHS
143 |
144 | # Look in other places.
145 | ${Poco_INCLUDE_DIR}
146 | ${POCO_DIR_SEARCH}
147 |
148 | # Help the user find it if we cannot.
149 | DOC "The ${POCO_LIBRARY_PATH_DESCRIPTION}"
150 | )
151 | SET(Poco_LIBRARY_DIR "" CACHE PATH POCO_LIBARARY_PATH_DESCRIPTION)
152 | GET_FILENAME_COMPONENT(Poco_LIBRARY_DIR ${Poco_FOUNDATION_LIB} PATH)
153 | SET(Poco_LIBRARIES "")
154 | SET(Comp_List "")
155 | IF(Poco_LIBRARY_DIR AND Poco_FOUNDATION_LIB)
156 | # Look for the poco binary path.
157 | SET(Poco_BINARY_DIR ${Poco_INCLUDE_DIR})
158 | IF(Poco_BINARY_DIR AND EXISTS "${Poco_BINARY_DIR}/bin")
159 | SET(Poco_BINARY_DIRS ${Poco_BINARY_DIR}/bin)
160 | ENDIF(Poco_BINARY_DIR AND EXISTS "${Poco_BINARY_DIR}/bin")
161 | ENDIF(Poco_LIBRARY_DIR AND Poco_FOUNDATION_LIB)
162 | IF(Poco_FOUNDATION_LIB)
163 | IF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
164 | SET(DBG "d")
165 | ELSE ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
166 | SET(DBG "")
167 | ENDIF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
168 | SET(Comp_List "Foundation${DBG}")
169 | FOREACH(COMPONENT ${Poco_FIND_COMPONENTS})
170 | FIND_LIBRARY(LIB${COMPONENT} "Poco${COMPONENT}${DBG}" Poco_LIBRARY_DIR)
171 | IF (LIB${COMPONENT})
172 | LIST(APPEND Poco_LIBRARIES "${LIB${COMPONENT}}")
173 | LIST(APPEND Comp_List "${COMPONENT}${DBG}")
174 | ENDIF(LIB${COMPONENT})
175 | ENDFOREACH(COMPONENT)
176 | LIST(REMOVE_DUPLICATES Comp_List)
177 | ENDIF(Poco_FOUNDATION_LIB)
178 | ENDIF(NOT Poco_LIBRARY_DIR)
179 | ENDIF(Poco_INCLUDE_DIR)
180 |
181 | IF(NOT Poco_FOUND)
182 | IF(Poco_FIND_QUIETLY)
183 | MESSAGE(STATUS "Poco was not found. ${POCO_INCLUDE_DIR_MESSAGE}")
184 | ELSE(Poco_FIND_QUIETLY)
185 | IF(Poco_FIND_REQUIRED)
186 | MESSAGE(FATAL_ERROR "Poco was not found. ${POCO_INCLUDE_DIR_MESSAGE}")
187 | ENDIF(Poco_FIND_REQUIRED)
188 | ENDIF(Poco_FIND_QUIETLY)
189 | ELSE(NOT Poco_FOUND)
190 | MESSAGE(STATUS " Found Poco!")
191 | SET(COMPONENT_STR "components found:")
192 | FOREACH(comp ${Comp_List})
193 | SET(COMPONENT_STR "${COMPONENT_STR}, ${comp}")
194 |
195 | ENDFOREACH(comp ${Comp_List})
196 | STRING(REPLACE ":," ":" COMPONENT_LSTR ${COMPONENT_STR})
197 | MESSAGE(STATUS "${COMPONENT_LSTR}.")
198 | ENDIF(NOT Poco_FOUND)
199 |
200 | #I added this in to add "libdl" on non-Windows systems. Technically dl is only neded if the "Foundation" component is used,
201 | #but i doesn't hurt to add it in anyway - mas
202 | if(Poco_FOUND AND NOT WIN32)
203 | LIST(APPEND Poco_LIBRARIES "dl")
204 | endif(Poco_FOUND AND NOT WIN32)
--------------------------------------------------------------------------------
/samples/c++/include/json.h:
--------------------------------------------------------------------------------
1 | /// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).
2 | /// It is intended to be used with #include "json/json.h"
3 |
4 | // //////////////////////////////////////////////////////////////////////
5 | // Beginning of content of file: LICENSE
6 | // //////////////////////////////////////////////////////////////////////
7 |
8 | /*
9 | The JsonCpp library's source code, including accompanying documentation,
10 | tests and demonstration applications, are licensed under the following
11 | conditions...
12 |
13 | The author (Baptiste Lepilleur) explicitly disclaims copyright in all
14 | jurisdictions which recognize such a disclaimer. In such jurisdictions,
15 | this software is released into the Public Domain.
16 |
17 | In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
18 | 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
19 | released under the terms of the MIT License (see below).
20 |
21 | In jurisdictions which recognize Public Domain property, the user of this
22 | software may choose to accept it either as 1) Public Domain, 2) under the
23 | conditions of the MIT License (see below), or 3) under the terms of dual
24 | Public Domain/MIT License conditions described here, as they choose.
25 |
26 | The MIT License is about as close to Public Domain as a license can get, and is
27 | described in clear, concise terms at:
28 |
29 | http://en.wikipedia.org/wiki/MIT_License
30 |
31 | The full text of the MIT License follows:
32 |
33 | ========================================================================
34 | Copyright (c) 2007-2010 Baptiste Lepilleur
35 |
36 | Permission is hereby granted, free of charge, to any person
37 | obtaining a copy of this software and associated documentation
38 | files (the "Software"), to deal in the Software without
39 | restriction, including without limitation the rights to use, copy,
40 | modify, merge, publish, distribute, sublicense, and/or sell copies
41 | of the Software, and to permit persons to whom the Software is
42 | furnished to do so, subject to the following conditions:
43 |
44 | The above copyright notice and this permission notice shall be
45 | included in all copies or substantial portions of the Software.
46 |
47 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
50 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
51 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
52 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
53 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
54 | SOFTWARE.
55 | ========================================================================
56 | (END LICENSE TEXT)
57 |
58 | The MIT license is compatible with both the GPL and commercial
59 | software, affording one all of the rights of Public Domain with the
60 | minor nuisance of being required to keep the above copyright notice
61 | and license text in the source code. Note also that by accepting the
62 | Public Domain "license" you can re-license your copy using whatever
63 | license you like.
64 |
65 | */
66 |
67 | // //////////////////////////////////////////////////////////////////////
68 | // End of content of file: LICENSE
69 | // //////////////////////////////////////////////////////////////////////
70 |
71 | #ifndef JSON_AMALGATED_H_INCLUDED
72 | #define JSON_AMALGATED_H_INCLUDED
73 | /// If defined, indicates that the source file is amalgated
74 | /// to prevent private header inclusion.
75 | #define JSON_IS_AMALGAMATION
76 |
77 | // //////////////////////////////////////////////////////////////////////
78 | // Beginning of content of file: include/json/version.h
79 | // //////////////////////////////////////////////////////////////////////
80 |
81 | // DO NOT EDIT. This file (and "version") is generated by CMake.
82 | // Run CMake configure step to update it.
83 | #ifndef JSON_VERSION_H_INCLUDED
84 | #define JSON_VERSION_H_INCLUDED
85 |
86 | #define JSONCPP_VERSION_STRING "1.6.5"
87 | #define JSONCPP_VERSION_MAJOR 1
88 | #define JSONCPP_VERSION_MINOR 6
89 | #define JSONCPP_VERSION_PATCH 5
90 | #define JSONCPP_VERSION_QUALIFIER
91 | #define JSONCPP_VERSION_HEXA \
92 | ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
93 |
94 | #endif // JSON_VERSION_H_INCLUDED
95 |
96 | // //////////////////////////////////////////////////////////////////////
97 | // End of content of file: include/json/version.h
98 | // //////////////////////////////////////////////////////////////////////
99 |
100 | // //////////////////////////////////////////////////////////////////////
101 | // Beginning of content of file: include/json/config.h
102 | // //////////////////////////////////////////////////////////////////////
103 |
104 | // Copyright 2007-2010 Baptiste Lepilleur
105 | // Distributed under MIT license, or public domain if desired and
106 | // recognized in your jurisdiction.
107 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
108 |
109 | #ifndef JSON_CONFIG_H_INCLUDED
110 | #define JSON_CONFIG_H_INCLUDED
111 |
112 | /// If defined, indicates that json library is embedded in CppTL library.
113 | //# define JSON_IN_CPPTL 1
114 |
115 | /// If defined, indicates that json may leverage CppTL library
116 | //# define JSON_USE_CPPTL 1
117 | /// If defined, indicates that cpptl vector based map should be used instead of
118 | /// std::map
119 | /// as Value container.
120 | //# define JSON_USE_CPPTL_SMALLMAP 1
121 |
122 | // If non-zero, the library uses exceptions to report bad input instead of C
123 | // assertion macros. The default is to use exceptions.
124 | #ifndef JSON_USE_EXCEPTION
125 | #define JSON_USE_EXCEPTION 1
126 | #endif
127 |
128 | /// If defined, indicates that the source file is amalgated
129 | /// to prevent private header inclusion.
130 | /// Remarks: it is automatically defined in the generated amalgated header.
131 | // #define JSON_IS_AMALGAMATION
132 |
133 | #ifdef JSON_IN_CPPTL
134 | #include
135 | #ifndef JSON_USE_CPPTL
136 | #define JSON_USE_CPPTL 1
137 | #endif
138 | #endif
139 |
140 | #ifdef JSON_IN_CPPTL
141 | #define JSON_API CPPTL_API
142 | #elif defined(JSON_DLL_BUILD)
143 | #if defined(_MSC_VER)
144 | #define JSON_API __declspec(dllexport)
145 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
146 | #endif // if defined(_MSC_VER)
147 | #elif defined(JSON_DLL)
148 | #if defined(_MSC_VER)
149 | #define JSON_API __declspec(dllimport)
150 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
151 | #endif // if defined(_MSC_VER)
152 | #endif // ifdef JSON_IN_CPPTL
153 | #if !defined(JSON_API)
154 | #define JSON_API
155 | #endif
156 |
157 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
158 | // integer
159 | // Storages, and 64 bits integer support is disabled.
160 | // #define JSON_NO_INT64 1
161 |
162 | #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
163 | // Microsoft Visual Studio 6 only support conversion from __int64 to double
164 | // (no conversion from unsigned __int64).
165 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1
166 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
167 | // characters in the debug information)
168 | // All projects I've ever seen with VS6 were using this globally (not bothering
169 | // with pragma push/pop).
170 | #pragma warning(disable : 4786)
171 | #endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
172 |
173 | #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
174 | /// Indicates that the following function is deprecated.
175 | #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
176 | #elif defined(__clang__) && defined(__has_feature)
177 | #if __has_feature(attribute_deprecated_with_message)
178 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
179 | #endif
180 | #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
181 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
182 | #elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
183 | #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
184 | #endif
185 |
186 | #if !defined(JSONCPP_DEPRECATED)
187 | #define JSONCPP_DEPRECATED(message)
188 | #endif // if !defined(JSONCPP_DEPRECATED)
189 |
190 | namespace Json
191 | {
192 | typedef int Int;
193 | typedef unsigned int UInt;
194 | #if defined(JSON_NO_INT64)
195 | typedef int LargestInt;
196 | typedef unsigned int LargestUInt;
197 | #undef JSON_HAS_INT64
198 | #else // if defined(JSON_NO_INT64)
199 | // For Microsoft Visual use specific types as long long is not supported
200 | #if defined(_MSC_VER) // Microsoft Visual Studio
201 | typedef __int64 Int64;
202 | typedef unsigned __int64 UInt64;
203 | #else // if defined(_MSC_VER) // Other platforms, use long long
204 | typedef long long int Int64;
205 | typedef unsigned long long int UInt64;
206 | #endif // if defined(_MSC_VER)
207 | typedef Int64 LargestInt;
208 | typedef UInt64 LargestUInt;
209 | #define JSON_HAS_INT64
210 | #endif // if defined(JSON_NO_INT64)
211 | } // end namespace Json
212 |
213 | #endif // JSON_CONFIG_H_INCLUDED
214 |
215 | // //////////////////////////////////////////////////////////////////////
216 | // End of content of file: include/json/config.h
217 | // //////////////////////////////////////////////////////////////////////
218 |
219 | // //////////////////////////////////////////////////////////////////////
220 | // Beginning of content of file: include/json/forwards.h
221 | // //////////////////////////////////////////////////////////////////////
222 |
223 | // Copyright 2007-2010 Baptiste Lepilleur
224 | // Distributed under MIT license, or public domain if desired and
225 | // recognized in your jurisdiction.
226 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
227 |
228 | #ifndef JSON_FORWARDS_H_INCLUDED
229 | #define JSON_FORWARDS_H_INCLUDED
230 |
231 | #if !defined(JSON_IS_AMALGAMATION)
232 | #include "config.h"
233 | #endif // if !defined(JSON_IS_AMALGAMATION)
234 |
235 | namespace Json
236 | {
237 |
238 | // writer.h
239 | class FastWriter;
240 | class StyledWriter;
241 |
242 | // reader.h
243 | class Reader;
244 |
245 | // features.h
246 | class Features;
247 |
248 | // value.h
249 | typedef unsigned int ArrayIndex;
250 | class StaticString;
251 | class Path;
252 | class PathArgument;
253 | class Value;
254 | class ValueIteratorBase;
255 | class ValueIterator;
256 | class ValueConstIterator;
257 |
258 | } // namespace Json
259 |
260 | #endif // JSON_FORWARDS_H_INCLUDED
261 |
262 | // //////////////////////////////////////////////////////////////////////
263 | // End of content of file: include/json/forwards.h
264 | // //////////////////////////////////////////////////////////////////////
265 |
266 | // //////////////////////////////////////////////////////////////////////
267 | // Beginning of content of file: include/json/features.h
268 | // //////////////////////////////////////////////////////////////////////
269 |
270 | // Copyright 2007-2010 Baptiste Lepilleur
271 | // Distributed under MIT license, or public domain if desired and
272 | // recognized in your jurisdiction.
273 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
274 |
275 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED
276 | #define CPPTL_JSON_FEATURES_H_INCLUDED
277 |
278 | #if !defined(JSON_IS_AMALGAMATION)
279 | #include "forwards.h"
280 | #endif // if !defined(JSON_IS_AMALGAMATION)
281 |
282 | namespace Json
283 | {
284 |
285 | /** \brief Configuration passed to reader and writer.
286 | * This configuration object can be used to force the Reader or Writer
287 | * to behave in a standard conforming way.
288 | */
289 | class JSON_API Features
290 | {
291 | public:
292 | /** \brief A configuration that allows all features and assumes all strings
293 | * are UTF-8.
294 | * - C & C++ comments are allowed
295 | * - Root object can be any JSON value
296 | * - Assumes Value strings are encoded in UTF-8
297 | */
298 | static Features all();
299 |
300 | /** \brief A configuration that is strictly compatible with the JSON
301 | * specification.
302 | * - Comments are forbidden.
303 | * - Root object must be either an array or an object value.
304 | * - Assumes Value strings are encoded in UTF-8
305 | */
306 | static Features strictMode();
307 |
308 | /** \brief Initialize the configuration like JsonConfig::allFeatures;
309 | */
310 | Features();
311 |
312 | /// \c true if comments are allowed. Default: \c true.
313 | bool allowComments_;
314 |
315 | /// \c true if root must be either an array or an object value. Default: \c
316 | /// false.
317 | bool strictRoot_;
318 |
319 | /// \c true if dropped null placeholders are allowed. Default: \c false.
320 | bool allowDroppedNullPlaceholders_;
321 |
322 | /// \c true if numeric object key are allowed. Default: \c false.
323 | bool allowNumericKeys_;
324 | };
325 |
326 | } // namespace Json
327 |
328 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED
329 |
330 | // //////////////////////////////////////////////////////////////////////
331 | // End of content of file: include/json/features.h
332 | // //////////////////////////////////////////////////////////////////////
333 |
334 | // //////////////////////////////////////////////////////////////////////
335 | // Beginning of content of file: include/json/value.h
336 | // //////////////////////////////////////////////////////////////////////
337 |
338 | // Copyright 2007-2010 Baptiste Lepilleur
339 | // Distributed under MIT license, or public domain if desired and
340 | // recognized in your jurisdiction.
341 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
342 |
343 | #ifndef CPPTL_JSON_H_INCLUDED
344 | #define CPPTL_JSON_H_INCLUDED
345 |
346 | #if !defined(JSON_IS_AMALGAMATION)
347 | #include "forwards.h"
348 | #endif // if !defined(JSON_IS_AMALGAMATION)
349 | #include
350 | #include
351 | #include
352 |
353 | #ifndef JSON_USE_CPPTL_SMALLMAP
354 | #include