------------------------------------------------------------ revno: 24 committer: Rick Stovall <fpstovall> branch nick: ricks-sprint-003 timestamp: Fri 2013-08-23 21:23:10 -0400 message: Roughed out the initial structures for the IPC support library. The header compiles clean. After review, I'll be completing the IPC classes shortly. added: cpp/common/ipc_channel/Makefile cpp/common/ipc_channel/ipc_channel.cpp cpp/common/ipc_channel/ipc_channel.h cpp/common/ipc_channel/ipc_channel_test.cpp
-- lp:~fpstovall/nrtb/fps-sprint-003 https://code.launchpad.net/~fpstovall/nrtb/fps-sprint-003 Your team NRTB Core is subscribed to branch lp:~fpstovall/nrtb/fps-sprint-003. To unsubscribe from this branch go to https://code.launchpad.net/~fpstovall/nrtb/fps-sprint-003/+edit-subscription
=== added file 'cpp/common/ipc_channel/Makefile' --- cpp/common/ipc_channel/Makefile 1970-01-01 00:00:00 +0000 +++ cpp/common/ipc_channel/Makefile 2013-08-24 01:23:10 +0000 @@ -0,0 +1,47 @@ +#*********************************************** +# This file is part of the NRTB project (https://launchpad.net/nrtb). +# +# NRTB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# NRTB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with NRTB. If not, see <http://www.gnu.org/licenses/>. +# +#*********************************************** + +target=ipc_channel + +lib: ${target}_test + @./${target}_test + @cp -v ${target}.h ../include/ + @cp -v ${target}.o ../obj/ + @echo build complete + +${target}_test: ${target}.o ${target}_test.cpp + @rm -f ${target}_test + g++ -c -O3 ${target}_test.cpp -I ../include ${bargs} + g++ -o ${target}_test ${target}_test.o ${target}.o ${largs} + + +${target}.o: ${target}.cpp ${target}.h Makefile + @rm -f ${target}.o + g++ -c -O3 ${target}.cpp -I ../include ${bargs} + +clean: + @rm -vf *.o ../include/${target}.h ../obj/${target}.o ${target}_test + @echo all objects and executables have been erased. + +switches=-std=gnu++11 -D _GLIBCXX_USE_SCHED_YIELD -D _GLIBCXX_USE_NANOSLEEP +libs=../obj/common.o ../obj/logger.o ../obj/serializer.o -lpthread +include=-I../include +bargs=${switches} ${include} +largs=${switches} ${libs} + + === added file 'cpp/common/ipc_channel/ipc_channel.cpp' --- cpp/common/ipc_channel/ipc_channel.cpp 1970-01-01 00:00:00 +0000 +++ cpp/common/ipc_channel/ipc_channel.cpp 2013-08-24 01:23:10 +0000 @@ -0,0 +1,27 @@ +/*********************************************** + This file is part of the NRTB project (https://*launchpad.net/nrtb). + + NRTB is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + NRTB is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with NRTB. If not, see <http://www.gnu.org/licenses/>. + + **********************************************/ + +// see base_socket.h for documentation + +#include "ipc_channel.h" + +namespace nrtb +{ + +} // namespace nrtb + === added file 'cpp/common/ipc_channel/ipc_channel.h' --- cpp/common/ipc_channel/ipc_channel.h 1970-01-01 00:00:00 +0000 +++ cpp/common/ipc_channel/ipc_channel.h 2013-08-24 01:23:10 +0000 @@ -0,0 +1,75 @@ +/*********************************************** + This file is part of the NRTB project (https://*launchpad.net/nrtb). + + NRTB is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + NRTB is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with NRTB. If not, see <http://www.gnu.org/licenses/>. + + **********************************************/ + +#ifndef ipc_channel_header +#define ipc_channel_header + +#include <common.h> +#include <linear_queue.h> +#include <memory> +#include <boost/concept_check.hpp> +#include <serializer.h> +#include <singleton.h> + + +namespace nrtb +{ + +class abs_ipc_record; + +typedef std::unique_ptr<abs_ipc_record> ipc_record_p; + +typedef linear_queue<ipc_record_p> ipc_queue; + +/** abs_ipc_record is the base for all ipc messages. + * This abstract includes a return_address (the + * ipc_queue the a return should be put to). but + * no other payload. It'll need to be overriden to + * provide whatever payload a given channel may + * need. + */ +class abs_ipc_record +{ + ipc_queue & return_address; +}; + +/** ipc_channel_manager provides a place to stash ipc_queues + * so that their scope is not tied to the lifetime of any + * particular thread. Ideally, this should be used as s + * singleton class. + */ +class ipc_channel_manager +{ +public: + typedef std::map<std::string,ipc_queue> channel_List; + typedef channel_List::iterator iterator; + + ipc_queue & get(std::string name); + iterator begin(); + iterator end(); + +private: + channel_List channels; +}; + +/// And here is the singleton class to make ipc channels safe. +typedef singleton<ipc_channel_manager> global_ipc_channel_manager; + +} // namepace nrtb + +#endif // ipc_channel_header === added file 'cpp/common/ipc_channel/ipc_channel_test.cpp' --- cpp/common/ipc_channel/ipc_channel_test.cpp 1970-01-01 00:00:00 +0000 +++ cpp/common/ipc_channel/ipc_channel_test.cpp 2013-08-24 01:23:10 +0000 @@ -0,0 +1,61 @@ +/*********************************************** + This file is part of the NRTB project (https://*launchpad.net/nrtb). + + NRTB is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + NRTB is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with NRTB. If not, see <http://www.gnu.org/licenses/>. + + **********************************************/ + +#include "ipc_channel.h" +#include <iostream> + +using namespace nrtb; +using namespace std; + + +int main() +{ + cout << "=========== IPC Channel test =============" + << endl; + + cout << "=========== IPC Channel test complete =============" + << endl; + +}; + + + + + + + + + + + + + + + + + + + + + + + + + + +
_______________________________________________ Mailing list: https://launchpad.net/~nrtb-core Post to : [email protected] Unsubscribe : https://launchpad.net/~nrtb-core More help : https://help.launchpad.net/ListHelp

