From 0782c0d10dac90ae26fac32b7fbc9ab10f147531 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Mon, 4 Feb 2008 13:31:36 +0000 Subject: [PATCH] making example cc_acc so make install produces runnable sems git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@652 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/Makefile | 2 +- apps/examples/tutorial/cc_acc/CCAcc.cpp | 4 ++-- apps/examples/tutorial/cc_acc/CCAcc.h | 9 ++++++++- apps/examples/tutorial/cc_acc/Makefile | 2 +- apps/sw_prepaid_sip/SWPrepaidSIP.cpp | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/Makefile b/apps/Makefile index 11d5cb09..7f4dae75 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -6,7 +6,7 @@ include $(COREPATH)/../Makefile.defs exclude_modules = mp3 examples modules = $(filter-out $(exclude_modules) \ $(wildcard Makefile*) CVS, \ - $(wildcard *) ) + $(wildcard *) ) examples/tutorial/cc_acc #modules = wav gsm ilbc bot echo announcement recorder voicemail dtmf_demo ivr .PHONY: all diff --git a/apps/examples/tutorial/cc_acc/CCAcc.cpp b/apps/examples/tutorial/cc_acc/CCAcc.cpp index 6623ad1a..bf1fb6bb 100644 --- a/apps/examples/tutorial/cc_acc/CCAcc.cpp +++ b/apps/examples/tutorial/cc_acc/CCAcc.cpp @@ -70,7 +70,7 @@ void CCAcc::invoke(const string& method, const AmArg& args, AmArg& ret) /* accounting functions... */ int CCAcc::getCredit(string pin) { credits_mut.lock(); - map::iterator it = credits.find(pin); + std::map::iterator it = credits.find(pin); if (it == credits.end()) { DBG("PIN '%s' does not exist.\n", pin.c_str()); credits_mut.unlock(); @@ -97,7 +97,7 @@ int CCAcc::addCredit(string pin, int amount) { int CCAcc::subtractCredit(string pin, int amount) { credits_mut.lock(); - map::iterator it = credits.find(pin); + std::map::iterator it = credits.find(pin); if (it == credits.end()) { ERROR("PIN '%s' dies not exist.", pin.c_str()); credits_mut.unlock(); diff --git a/apps/examples/tutorial/cc_acc/CCAcc.h b/apps/examples/tutorial/cc_acc/CCAcc.h index 57ab8546..55010ab8 100644 --- a/apps/examples/tutorial/cc_acc/CCAcc.h +++ b/apps/examples/tutorial/cc_acc/CCAcc.h @@ -1,5 +1,10 @@ +#ifndef _CC_ACC_H +#define _CC_ACC_H + #include "AmApi.h" +#include + /** * accounting class for calling card. * this illustrates the DI interface @@ -18,7 +23,7 @@ class CCAcc : public AmDynInvoke /** sets the value to some amount */ int setCredit(string pin, int amount); - map credits; + std::map credits; // as this is used from various sessions, // it must be protected by a mutex AmMutex credits_mut; @@ -30,3 +35,5 @@ class CCAcc : public AmDynInvoke static CCAcc* instance(); void invoke(const string& method, const AmArg& args, AmArg& ret); }; + +#endif diff --git a/apps/examples/tutorial/cc_acc/Makefile b/apps/examples/tutorial/cc_acc/Makefile index 028c7acc..61c39b97 100644 --- a/apps/examples/tutorial/cc_acc/Makefile +++ b/apps/examples/tutorial/cc_acc/Makefile @@ -3,5 +3,5 @@ plug_in_name = cc_acc module_ldflags = module_cflags = -COREPATH ?=../../../../core +COREPATH =../../../../core include $(COREPATH)/plug-in/Makefile.app_module diff --git a/apps/sw_prepaid_sip/SWPrepaidSIP.cpp b/apps/sw_prepaid_sip/SWPrepaidSIP.cpp index ed31a5d3..142c9383 100644 --- a/apps/sw_prepaid_sip/SWPrepaidSIP.cpp +++ b/apps/sw_prepaid_sip/SWPrepaidSIP.cpp @@ -66,7 +66,7 @@ int SWPrepaidSIPFactory::onLoad() return -1; } - DBG("use acc plugin '%s'", acc_plugin.c_str()); + DBG("using acc plugin '%s'\n", acc_plugin.c_str()); cc_acc_fact = AmPlugIn::instance()->getFactory4Di(acc_plugin); if(!cc_acc_fact) { ERROR("could not load accounting plugin '%s', please provide a valid module name\n",