| 1 | /********************************************************************** |
|---|
| 2 | * Copyright (c) 2005-2008 David Carter <dcarter@arm4.org> and others. |
|---|
| 3 | * All rights reserved. This program and the accompanying materials |
|---|
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
|---|
| 5 | * which accompanies this distribution, and is available at |
|---|
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
|---|
| 7 | * |
|---|
| 8 | * Contributors: |
|---|
| 9 | * David Carter - Initial API and implementation |
|---|
| 10 | **********************************************************************/ |
|---|
| 11 | |
|---|
| 12 | #ifndef LIBARM4DBTESTDAEMON_H /* Prevent multiple inclusion */ |
|---|
| 13 | #define LIBARM4DBTESTDAEMON_H 1 |
|---|
| 14 | |
|---|
| 15 | #include <sys/types.h> |
|---|
| 16 | #include <unistd.h> |
|---|
| 17 | |
|---|
| 18 | #include "Arm4db.h" |
|---|
| 19 | #include "Arm4dbConfig.h" |
|---|
| 20 | |
|---|
| 21 | class Arm4DbTestDaemon { |
|---|
| 22 | public: |
|---|
| 23 | /* Constructors */ |
|---|
| 24 | Arm4DbTestDaemon (const std::string &config_filename); |
|---|
| 25 | |
|---|
| 26 | /* Destructors */ |
|---|
| 27 | virtual ~Arm4DbTestDaemon (); |
|---|
| 28 | |
|---|
| 29 | /* Accessors */ |
|---|
| 30 | std::string getXml (void) const; |
|---|
| 31 | std::string getXmlDefinitions (void) const; |
|---|
| 32 | xmlDocPtr getXmlDoc (void) const; |
|---|
| 33 | xmlDocPtr getXmlDocDefinitions (void) const; |
|---|
| 34 | |
|---|
| 35 | /* Mutators */ |
|---|
| 36 | |
|---|
| 37 | /* Operations */ |
|---|
| 38 | void start (void); |
|---|
| 39 | void stop (void); |
|---|
| 40 | void clear (void); // Also stops the database |
|---|
| 41 | void dbsync (void) const; |
|---|
| 42 | |
|---|
| 43 | bool exportIsValidatedXml (void); |
|---|
| 44 | bool exportIsValidatedXmlDefinitions (void); |
|---|
| 45 | bool exportIsValidatedXml (const std::string &xml); |
|---|
| 46 | void import (const std::string &xml); |
|---|
| 47 | |
|---|
| 48 | // Wrappers for the Arm4Db versions |
|---|
| 49 | std::list<arm_id_t> *getApplicationList (void); |
|---|
| 50 | std::list<arm_id_t> *getTransactionList (void); |
|---|
| 51 | std::list<arm_id_t> *getTransactionList (const arm_id_t &app_id); |
|---|
| 52 | std::list<arm_tran_start_handle_t> *getTransactionInstanceList (const arm_id_t &tran_id); |
|---|
| 53 | int getApplicationCount (void); |
|---|
| 54 | int getTransactionCount (void); |
|---|
| 55 | int getTransactionCount (const arm_id_t &app_id); |
|---|
| 56 | void getApplicationInformation (const arm_id_t &app_id, arm4db_application_summary_t *summary_ptr); |
|---|
| 57 | void getTransactionInformation (const arm_id_t &tran_id, arm4db_transaction_summary_t *summary_ptr); |
|---|
| 58 | const arm_correlator_t *getCorrelator (arm_tran_start_handle_t tran_handle, arm_correlator_t *correlator_ptr); |
|---|
| 59 | const arm_correlator_t *getParentCorrelator (arm_tran_start_handle_t tran_handle, arm_correlator_t *correlator_ptr); |
|---|
| 60 | |
|---|
| 61 | /* Operators */ |
|---|
| 62 | |
|---|
| 63 | protected: |
|---|
| 64 | |
|---|
| 65 | private: |
|---|
| 66 | /* Mark these as private to prevent their use */ |
|---|
| 67 | Arm4DbTestDaemon (); |
|---|
| 68 | Arm4DbTestDaemon (const Arm4DbTestDaemon &); |
|---|
| 69 | Arm4DbTestDaemon &operator= (const Arm4DbTestDaemon &); |
|---|
| 70 | |
|---|
| 71 | const Arm4dbConfig &getConfig (void) { return Arm4dbConfig::getConfig (); } |
|---|
| 72 | |
|---|
| 73 | void initialize (); |
|---|
| 74 | static void childHandler (int signum); |
|---|
| 75 | |
|---|
| 76 | pid_t m_pid; |
|---|
| 77 | }; |
|---|
| 78 | |
|---|
| 79 | #endif /* LIBARM4DBTESTDAEMON_H */ |
|---|