]> pilppa.com Git - libplpbus.git/commitdiff
added .gitignore and started converting to use libplp for debug
authorMika Laitio <lamikr@pilppa.org>
Sun, 3 Oct 2010 22:09:17 +0000 (01:09 +0300)
committerMika Laitio <lamikr@pilppa.org>
Sun, 3 Oct 2010 22:09:17 +0000 (01:09 +0300)
.gitignore [new file with mode: 0644]
autobuild.sh
configure.ac
src/plpbus/BusClient.cc
src/plpbus/BusMessage.cc
src/plpbus/OrbServerImpl.cc

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..54c1281
--- /dev/null
@@ -0,0 +1,2 @@
+m4
+autom4te.cache
index c3185915ac8428cf8424c807c6ca7e17772ba447..bb273c027f4c435866b6b09880be8ecb6902bb3c 100755 (executable)
@@ -1,11 +1,12 @@
 #!/bin/sh
 
+export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 
 if ! [ -e Makefile ] ;
 then
        echo "No Makefile available, generating it."
        libtoolize --automake --force --copy
        autoreconf --force --install
-        PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --prefix=/usr/local
+        ./configure --prefix=/usr/local
 else
        echo "Makefile found, no need to generate it."
 fi
index e3655ff84dc989d1eedb620cb57de80c14783263..02b65ca3560817427d99e23d3507ff77298000d2 100644 (file)
@@ -21,7 +21,7 @@ AM_PROG_CC_C_O
 
 PKG_PROG_PKG_CONFIG()
 
-PKG_CHECK_MODULES(SRC, omniDynamic4)
+PKG_CHECK_MODULES(SRC, omniDynamic4 libplp)
 AC_SUBST(SRC_CFLAGS)
 AC_SUBST(SRC_LIBS)
 
index 8c93e1d2f0e015d25f76a3ad3be8d6b3f531c2f6..b69787b7d64081a5ff22f84cb2d476d35310a9e8 100644 (file)
@@ -5,6 +5,8 @@
  *      Author: lamikr
  */
 
+#include <plp/log.h>
+
 #include "BusClient.hh"
 #include "BusMessageInternal.hh"
 
@@ -54,7 +56,7 @@ class OrbClientImpl : public virtual POA_plpbus_orb::OrbClient
 
 BusClient::BusClient()
 {
-       cout << "created" << endl;
+       log_debug("created\n");;
        _orb            = NULL;
        _poa            = NULL;
 }
@@ -65,7 +67,7 @@ BusClient::~BusClient()
                _orb->destroy();
                _orb    = NULL;
        }
-       cout << "destroyed" << endl;
+       log_debug("destroyed\n");
 }
 
 int BusClient::init(const char *server_name) {
@@ -75,10 +77,10 @@ int BusClient::init(const char *server_name) {
 
        argc    = 0;
        argv    = NULL;
-       cout << "init() started"  << endl;
+       log_info("init() started\n");;
        _orb    = CORBA::ORB_init(argc, argv);
        if (_orb != NULL) {
-               cout << "ORB_init() done, finding server: " << server_name << endl;
+               log_debug("ORB_init() done, finding server: %s\n", server_name);
                server_obj      = find_server_object_by_name(_orb,
                                                        CONST_CONTEXT_NAME__PLPBUS,
                                                        CONST_CONTEXT_KIND__PLPBUS,
@@ -86,22 +88,21 @@ int BusClient::init(const char *server_name) {
                                                        CONST_CONTEXT_NAME__PLPBUS);
                if (CORBA::is_nil(server_obj) == false) {
                        _server         = plpbus_orb::OrbServer::_narrow(server_obj);
-                       cout << "Server object found: " << server_name << endl;
+                       log_info("Server object found: %s", server_name);
                }
                else {
-                       cerr << "Could not find server object: " << server_name << endl;
+                       log_error("Could not find server object: %s\n", server_name);
                }
        }
        return 0;
 }
 
 int BusClient::add_client_listener(IClientListener *listener_param) {
-       cout << "add_client_listener() started"  << endl;
+       log_debug("add_client_listener() started\n");
        if (_poa == NULL) {
                OrbClientImpl                   *client_cb;
                PortableServer::ObjectId_var    oid;
 
-               cout << "register_callback() 1"  << endl;
                _poa            = create_poa(_orb);
                client_cb       = new OrbClientImpl(listener_param);
                oid             = _poa->activate_object(client_cb);
@@ -109,7 +110,7 @@ int BusClient::add_client_listener(IClientListener *listener_param) {
                client_cb->_remove_ref();
                _server->add_event_listener(_client, "event_message", CONST_DEFAULT_EVENT_INTERVAL);
        }
-       cout << "add_client_listener() done"  << endl;
+       log_debug("add_client_listener() done\n");
        return 0;
 }
 
@@ -226,17 +227,17 @@ CORBA::Object_var BusClient::find_server_object_by_name(CORBA::ORB_var orb_param
                        ret_val = ns_root_context->resolve(service_data);
                }
                catch(CosNaming::NamingContext::NotFound& ex) {
-                       cerr << "Could not find service from the name server. " << endl;
+                       log_error("Could not find service from the name server.\n");
                }
                catch(CORBA::TRANSIENT& ex) {
-                       cerr << "Could not find service from the name server. " << endl;
+                       log_error("Could not find service from the name server.\n");
                }
                catch(CORBA::SystemException& ex) {
-                       cerr << "Could not find service from the name server, unknown error." << endl;
+                       log_error("Could not find service from the name server, unknown error.\n");
                }
        }
        else {
-               cerr << "Could not find naming service. " << endl;
+               log_error("Could not find naming service.\n");
        }
        return ret_val;
 }
index 2e52f1f2c7e35ffb0ea89029bb29e27e9044892b..bc05f0755b38eb6de855d5ea4aacd1c484f28dcc 100644 (file)
@@ -5,6 +5,8 @@
  *      Author: lamikr
  */
 
+#include <plp/log.h>
+
 #include "BusMessage.hh"
 
 using namespace std;
@@ -169,14 +171,14 @@ void BusMessage::printout_dataitem(long index, plpbus_orb::DataItem *item) {
                                                const char *val;
 
                                                item->value >>= val;
-                                               cout << "       [" << index << "] name: " << item->name << ", value: " << val << endl;
+                                               log_debug("     [%d], value: %s\n", index, val);
                                        }
                                        break;
                                case tk_long:
                                        {
                                                long    val;
                                                item->value >>= val;
-                                               cout << "       [" << index << "] name: " << item->name << ", value: " << val << endl;
+                                               log_debug("     [%d], value: %ld\n", index, val);
                                                //val_str       = strdup("long");
                                        }
                                        break;
@@ -184,7 +186,7 @@ void BusMessage::printout_dataitem(long index, plpbus_orb::DataItem *item) {
                                        {
                                                double val;
                                                item->value >>= val;
-                                               cout << "       [" << index << "] name: " << item->name << ", value: " << val << endl;
+                                               log_debug("     [%d], value: %f\n", index, val);
                                                //val_str       = strdup("double");
                                        }
                                        break;
@@ -192,20 +194,20 @@ void BusMessage::printout_dataitem(long index, plpbus_orb::DataItem *item) {
                                        {
                                                float val;
                                                item->value >>= val;
-                                               cout << "       [" << index << "] name: " << item->name << ", value: " << val << endl;
+                                               log_debug("     [%d] name: %s, value: %f\n", index, val);
                                                //val_str       = strdup("float");
                                        }
                                        break;
                                default:
-                                       cout << "       [" << index << "] name: " << item->name << ", value unknown. " << endl;
+                                       log_error("     [%d] name, value unknown\n", index);
                        }
                }
                else {
-                       cout << "       [" << index << "] Invalid dataItem, name or value NULL." << endl;
+                       log_error("     [%d] Invalid data item name name or value\n", index);
                }
        }
        else {
-               cout << "       [" << index << "] dataItem NULL." << endl;
+               log_error("     [%d] dataItem NULL.", index);
        }
 }
 
@@ -214,10 +216,10 @@ void BusMessage::printout() {
        DataItem        item;
 
        count   = _dataItemSeq.length();
-       cout << "BusMessage.printout(): parameter count: " << count << endl;
+       log_debug("BusMessage.printout(): parameter count: %l\n", count);
        for (long ii = 0; ii < count; ii++) {
                item    = _dataItemSeq[ii];
                printout_dataitem(ii, &item);
        }
-       cout << "BusMessage.printout() done" << endl;
+       log_debug("BusMessage.printout() done\n");;
 }
index d12846e206c7f4b27637915c20a1b04696b5b9b2..fc0eeccae73f6ea6e30e21d4e595d430ab0010f3 100644 (file)
@@ -5,6 +5,8 @@
  *      Author: lamikr
  */
 
+#include <plp/log.h>
+
 #include "ServerEventThread.hh"
 #include "OrbServerImpl.hh"
 #include "ClientServerCommon.hh"
@@ -28,7 +30,7 @@ OrbServerImpl::OrbServerImpl()
 
 OrbServerImpl::~OrbServerImpl()
 {
-       cout << "OrbServerImpl destroyed." << endl;
+       log_info("OrbServerImpl destroyed.\n");
 }
 
 void OrbServerImpl::send_message_and_request_response(OrbClient_ptr response_listener_param,
@@ -39,16 +41,16 @@ void OrbServerImpl::send_message_and_request_response(OrbClient_ptr response_lis
        msg_rsp = NULL;
        if (CORBA::is_nil(response_listener_param) == false) {
                if (_listener != NULL) {
-                       cout << "send_message_and_request_response(): " << msg_req << ", server_callback != NULL" << endl;
+                       log_debug("send_message_and_request_response(): %s, server callback != NULL\n", msg_req);
                        _listener->request_received(msg_req, &msg_rsp);
                        response_listener_param->receive_response_message(msg_rsp);
                }
                else {
-                       cout << "send_message_and_request_response() error! " << msg_req << ", server_callback == NULL" << endl;
+                       log_error("send_message_and_request_response() error, server callback == NULL\n");
                }
        }
        else {
-               cerr << "invalid callback object received.\n";
+               log_error("invalid callback object received.\n");
        }
 }
 
@@ -59,11 +61,11 @@ char *OrbServerImpl::send_message_and_wait_response(const char* msg_req_param, :
        err_flg = 0;
        msg_rsp = NULL;
        if (_listener != NULL) {
-               cout << "send_message_and_wait_response(): " << msg_req_param << ", server_callback != NULL" << endl;
+               log_debug("send_message_and_wait_response(): %s, server_callback != NULL\n", msg_req_param);
                _listener->request_received(msg_req_param, &msg_rsp);
        }
        else {
-               cout << "send_message_and_wait_response() error! " << msg_req_param << ", server_callback == NULL" << endl;
+               log_error("send_message_and_wait_response() error, server callback == NULL\n");
                msg_rsp = strdup(msg_req_param);
                err_flg = -1;
        }
@@ -79,17 +81,17 @@ void OrbServerImpl::send_dataitem_message_and_request_response(OrbClient_ptr res
        if (CORBA::is_nil(response_listener_param) == false) {
                if (_listener != NULL) {
                        msg_req = new BusMessageInternal(msg_req_param);
-                       cout << "send_dataitem_message_and_request_response(), server_callback != NULL" << endl;
-                       cout << "msg_req:" << endl;
+                       log_debug("send_dataitem_message_and_request_response(), server_callback != NULL\n");
+                       log_debug("msg_req:\n");
                        msg_req->printout();
                        msg_rsp = NULL;
                        _listener->request_received(msg_req, &msg_rsp);
-                       cout << "msg_rsp length:" << msg_rsp->_dataItemSeq.length() << endl;
+                       log_debug("msg_rsp length: %d\n", msg_rsp->_dataItemSeq.length());
                        msg_rsp->printout();
                        response_listener_param->receive_response_dataitem_sequence(msg_rsp->_dataItemSeq);
                }
                else {
-                       cout << "send_dataitem_message_and_request_response() error, server_callback == NULL" << endl;
+                       log_error("send_dataitem_message_and_request_response() error, server_callback == NULL\n");
                }
        }
 }
@@ -115,7 +117,7 @@ void OrbServerImpl::add_event_listener(OrbClient_ptr client_param,
        ServerEventThread       *srvr_thread;
 
        if (CORBA::is_nil(client_param) == false) {
-               cout << "add_event_listener()" << endl;
+               log_debug("add_event_listener()\n");
                server_thread_mutex.lock();
                _server_thread_count++;
                server_thread_mutex.unlock();