summaryrefslogtreecommitdiff
path: root/cpp/examples/qmf-agent/example.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2008-09-15 15:37:59 +0000
committerTed Ross <tross@apache.org>2008-09-15 15:37:59 +0000
commit33d9364f9c3bc648faa1d04f3c02e58a9e5ad284 (patch)
tree51699a22646fa02546da8b298b915df344646b8e /cpp/examples/qmf-agent/example.cpp
parent5fc5a4610b2e85e245c752b81976dca36cc94666 (diff)
downloadqpid-python-33d9364f9c3bc648faa1d04f3c02e58a9e5ad284.tar.gz
QPID-1274 - Changed C++ namespace for generated management code. Improved efficiency of generated functions to use const references for non-simple types.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@695511 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/examples/qmf-agent/example.cpp')
-rw-r--r--cpp/examples/qmf-agent/example.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/cpp/examples/qmf-agent/example.cpp b/cpp/examples/qmf-agent/example.cpp
index 3422704d60..2087ee0811 100644
--- a/cpp/examples/qmf-agent/example.cpp
+++ b/cpp/examples/qmf-agent/example.cpp
@@ -26,7 +26,7 @@
#include "Parent.h"
#include "Child.h"
#include "ArgsParentCreate_child.h"
-#include "PackageQmf_example.h"
+#include "Package.h"
#include <unistd.h>
#include <cstdlib>
@@ -34,13 +34,13 @@
#include <sstream>
-using namespace qpid::management;
-using namespace qpid::sys;
using namespace std;
+using qpid::management::ManagementAgent;
using qpid::management::ManagementObject;
using qpid::management::Manageable;
using qpid::management::Args;
using qpid::sys::Mutex;
+namespace _qmf = qmf::org::apache::qpid::agent::example;
class ChildClass;
@@ -52,7 +52,7 @@ class CoreClass : public Manageable
{
string name;
ManagementAgent* agent;
- Parent* mgmtObject;
+ _qmf::Parent* mgmtObject;
std::vector<ChildClass*> children;
Mutex vectorLock;
@@ -71,7 +71,7 @@ public:
class ChildClass : public Manageable
{
string name;
- Child* mgmtObject;
+ _qmf::Child* mgmtObject;
public:
@@ -90,7 +90,7 @@ public:
CoreClass::CoreClass(ManagementAgent* _agent, string _name) : name(_name), agent(_agent)
{
static uint64_t persistId = 0x111222333444555LL;
- mgmtObject = new Parent(agent, this, name);
+ mgmtObject = new _qmf::Parent(agent, this, name);
agent->addObject(mgmtObject, persistId++);
mgmtObject->set_state("IDLE");
@@ -102,7 +102,7 @@ void CoreClass::doLoop()
while (1) {
sleep(1);
mgmtObject->inc_count();
- mgmtObject->set_state("IN LOOP");
+ mgmtObject->set_state("IN_LOOP");
{
Mutex::ScopedLock _lock(vectorLock);
@@ -121,8 +121,8 @@ Manageable::status_t CoreClass::ManagementMethod(uint32_t methodId, Args& args,
Mutex::ScopedLock _lock(vectorLock);
switch (methodId) {
- case Parent::METHOD_CREATE_CHILD:
- ArgsParentCreate_child& ioArgs = (ArgsParentCreate_child&) args;
+ case _qmf::Parent::METHOD_CREATE_CHILD:
+ _qmf::ArgsParentCreate_child& ioArgs = (_qmf::ArgsParentCreate_child&) args;
ChildClass *child = new ChildClass(agent, this, ioArgs.i_name);
ioArgs.o_childRef = child->GetManagementObject()->getObjectId();
@@ -139,7 +139,7 @@ Manageable::status_t CoreClass::ManagementMethod(uint32_t methodId, Args& args,
ChildClass::ChildClass(ManagementAgent* agent, CoreClass* parent, string name)
{
- mgmtObject = new Child(agent, this, parent, name);
+ mgmtObject = new _qmf::Child(agent, this, parent, name);
agent->addObject(mgmtObject);
}
@@ -158,7 +158,7 @@ int main_int(int argc, char** argv)
ManagementAgent* agent = singleton.getInstance();
// Register the Qmf_example schema with the agent
- PackageQmf_example packageInit(agent);
+ _qmf::Package packageInit(agent);
// Start the agent. It will attempt to make a connection to the
// management broker