| 366 | |
| 367 | |
| 368 | === Instrumenting other applications === |
| 369 | Steps to instrument other c++ applications: |
| 370 | 1. Add ''CWriteOml.h'' & ''CWriteOml.cpp'' into your project. Include the header file in the relevant source file where OML functions would be called. |
| 371 | > #include "CWriteOml.h" |
| 372 | |
| 373 | 2. Identify variables for sensor / measurement data to be recorded. These would be from your original source files. |
| 374 | |
| 375 | 3. Create a OML class object. |
| 376 | > CWriteOml oml; |
| 377 | |
| 378 | 4. Call the member function init() to initialize with an ID, database file name and storage location. |
| 379 | > CWriteOml::init(std::string oml_id, std::string oml_domain, std::string oml_collect); |
| 380 | |
| 381 | 5. Register the variables for sensor / measurement data (from above) with a variable name and corresponding type. This is a individual measurement point. |
| 382 | > CWriteOml::register_mp(std::string str_variable, OmlValueT oml_value_type); |
| 383 | |
| 384 | 6. Once the collection of measurement points are registered, call start() to kick off the recording session. |
| 385 | > CWriteOml::start() |
| 386 | |
| 387 | 7. Update measurement points with new value. |
| 388 | > CWriteOml::set_mp(std::string key_str, void* val_ptr); |
| 389 | > CWriteOml::set_mp_blob(std::string key_str, void* val_ptr, unsigned int omlblob_bytes); |
| 390 | Use set_mp() for int32, int64, uint32, double, string.[[BR]] |
| 391 | Use set_mp_blob() for binary data. |
| 392 | |
| 393 | 8. When ready to record the collection of measurement points call insert(). |
| 394 | > CWriteOml::insert() |
| 395 | |
| 396 | 9. The application is done with the recording session, use stop(). |
| 397 | > CWriteOml::stop() |
| 398 | |
| 399 | 10. Compile and link the application with -loml2 -locomm |
| 400 | |