diff --git a/.gitignore b/.gitignore index c3a3b4250b471d8af67acf16b79285a0cd9f1713..59a87a9665eaddbc66268b9ee5257dca7ec18702 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,6 @@ *.un~ Session.vim **/manifest.mf +**/**/manifest.mf **/*.*~ diff --git a/build.xml b/build.xml index ab09dfad26688a8e48f3333474f4410a1fa13dae..f230ed6accb7cdef5ae6690d5d028f26729bcea5 100644 --- a/build.xml +++ b/build.xml @@ -1,3 +1,3 @@ <project name="ipaaca-all" default="build" basedir="."> - <import file="../soashared/ant/build-recurse.xml" /> + <import file="../hmibuild/build-recurse.xml" /> </project> diff --git a/ipaacalib/build.xml b/ipaacalib/build.xml index 6c8df304272f5bdf9cfc895b761728df02b896b2..f57d5344512cec59f73243c198c1a1fa1f7ad0d8 100644 --- a/ipaacalib/build.xml +++ b/ipaacalib/build.xml @@ -1,3 +1,3 @@ <project name="ipaacalib" default="build" basedir="."> - <import file="../../soashared/ant/build-recurse.xml" /> + <import file="../../hmibuild/build-recurse.xml" /> </project> diff --git a/ipaacalib/cpp/CMakeLists.txt b/ipaacalib/cpp/CMakeLists.txt index 01de03246d36841b1fb714681f437dfb1fc5d63c..18727d7189b37c3555ee76ca6ac2d1bb075c1fd1 100644 --- a/ipaacalib/cpp/CMakeLists.txt +++ b/ipaacalib/cpp/CMakeLists.txt @@ -50,13 +50,15 @@ include_directories( ${PROJECT_SOURCE_DIR}/build ) # add local include directory include_directories( ${PROJECT_SOURCE_DIR}/include ) # add lib and include directory from pulled dependencies -include_directories( ${PROJECT_SOURCE_DIR}/lib/include ) -link_directories( ${PROJECT_SOURCE_DIR}/lib ) +include_directories( ${PROJECT_SOURCE_DIR}/../../deps/include ) +link_directories( ${PROJECT_SOURCE_DIR}/../../deps/lib ) # specify source files for ipaaca (auto-generated ones are in build/ ) set (SOURCE src/ipaaca.cc - build/ipaaca.pb.cc + src/ipaaca-cmdline-parser.cc + src/ipaaca-string-utils.cc + build/ipaaca/ipaaca.pb.cc ) # compile all files to "ipaaca" shared library @@ -81,8 +83,8 @@ install( FILES_MATCHING PATTERN "*.h" PATTERN "*.hh" PATTERN "*.hpp" PATTERN "*.inl" ) install( - FILES build/ipaaca.pb.h - DESTINATION /include + FILES build/ipaaca/ipaaca.pb.h + DESTINATION /include/ipaaca/ ) diff --git a/ipaacalib/cpp/build.xml b/ipaacalib/cpp/build.xml index 36846dea60a9076ed807b9991af8afb835d0a1b8..75ed860ffc377c3c0c073305221ea7b58bf32d79 100644 --- a/ipaacalib/cpp/build.xml +++ b/ipaacalib/cpp/build.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="IpaacaCpp" default="dist"> - <import file="../../../soashared/ant/build.xml" /> + <import file="../../../hmibuild/build.xml" /> <target name="check-proto-files"> <echo message="Checking whether compiled protobuf files are already present..." /> <available file="build/ipaaca.pb.h" property="pb.present"/> @@ -10,10 +10,11 @@ </target> <target name="-proto-no" depends="check-proto-files" unless="pb.present"> <echo message="Compiling protobuf files" /> + <mkdir dir="${build.dir}/ipaaca" /> <exec executable="protoc"> <arg value="--proto_path=../proto" /> <arg value="../proto/ipaaca.proto" /> - <arg value="--cpp_out=build/" /> + <arg value="--cpp_out=build/ipaaca/" /> </exec> </target> <target name="-pre-compilation" depends="-proto-yes,-proto-no" /> diff --git a/ipaacalib/cpp/include/ipaaca.h b/ipaacalib/cpp/include/ipaaca/ipaaca.h similarity index 88% rename from ipaacalib/cpp/include/ipaaca.h rename to ipaacalib/cpp/include/ipaaca/ipaaca.h index d08732d9c798651899da1a32028a77d87ec7a77a..541ec59b5d89b765c5bb75d52da025b256b0fef6 100644 --- a/ipaacalib/cpp/include/ipaaca.h +++ b/ipaacalib/cpp/include/ipaaca/ipaaca.h @@ -1,5 +1,5 @@ #ifndef __IPAACA_H__ -#define __IPAACA_H_ +#define __IPAACA_H__ /// ipaaca/IU/RSB protocol major version number #define IPAACA_PROTOCOL_VERSION_MAJOR 1 @@ -45,16 +45,16 @@ #include <rsb/converter/Converter.h> #include <rsb/rsbexports.h> -#include <ipaaca.pb.h> +#include <ipaaca/ipaaca.pb.h> #include <pthread.h> #include <uuid/uuid.h> //using namespace boost; -using namespace rsb; -using namespace rsb::filter; -using namespace rsb::converter; -using namespace rsb::patterns; +//using namespace rsb; +//using namespace rsb::filter; +//using namespace rsb::converter; +//using namespace rsb::patterns; namespace ipaaca { @@ -218,14 +218,14 @@ class Buffer { //: public boost::enable_shared_from_this<Buffer> {//{{{ }; //}}} -class CallbackIUPayloadUpdate: public Server::Callback<IUPayloadUpdate, int> { +class CallbackIUPayloadUpdate: public rsb::patterns::Server::Callback<IUPayloadUpdate, int> { protected: Buffer* _buffer; public: CallbackIUPayloadUpdate(Buffer* buffer); boost::shared_ptr<int> call(const std::string& methodName, boost::shared_ptr<IUPayloadUpdate> update); }; -class CallbackIULinkUpdate: public Server::Callback<IULinkUpdate, int> { +class CallbackIULinkUpdate: public rsb::patterns::Server::Callback<IULinkUpdate, int> { protected: Buffer* _buffer; public: @@ -233,7 +233,7 @@ class CallbackIULinkUpdate: public Server::Callback<IULinkUpdate, int> { public: boost::shared_ptr<int> call(const std::string& methodName, boost::shared_ptr<IULinkUpdate> update); }; -class CallbackIUCommission: public Server::Callback<protobuf::IUCommission, int> { +class CallbackIUCommission: public rsb::patterns::Server::Callback<protobuf::IUCommission, int> { protected: Buffer* _buffer; public: @@ -247,10 +247,10 @@ class OutputBuffer: public Buffer { //, public boost::enable_shared_from_this<Ou friend class RemotePushIU; protected: protected: - std::map<std::string, Informer<AnyType>::Ptr> _informer_store; + std::map<std::string, rsb::Informer<rsb::AnyType>::Ptr> _informer_store; IUStore _iu_store; Lock _iu_id_counter_lock; - ServerPtr _server; + rsb::patterns::ServerPtr _server; protected: // informing functions void _send_iu_link_update(IUInterface* iu, bool is_delta, revision_t revision, const LinkMap& new_links, const LinkMap& links_to_remove, const std::string& writer_name="undef"); @@ -263,7 +263,7 @@ class OutputBuffer: public Buffer { //, public boost::enable_shared_from_this<Ou protected: void _publish_iu(boost::shared_ptr<IU> iu); void _retract_iu(boost::shared_ptr<IU> iu); - Informer<AnyType>::Ptr _get_informer(const std::string& category); + rsb::Informer<rsb::AnyType>::Ptr _get_informer(const std::string& category); protected: OutputBuffer(const std::string& basename); void _initialize_server(); @@ -285,8 +285,8 @@ class InputBuffer: public Buffer { //, public boost::enable_shared_from_this<Inp friend class IU; friend class RemotePushIU; protected: - std::map<std::string, ListenerPtr> _listener_store; - std::map<std::string, RemoteServerPtr> _remote_server_store; + std::map<std::string, rsb::ListenerPtr> _listener_store; + std::map<std::string, rsb::patterns::RemoteServerPtr> _remote_server_store; RemotePushIUStore _iu_store; // TODO genericize protected: inline void _send_iu_link_update(IUInterface* iu, bool is_delta, revision_t revision, const LinkMap& new_links, const LinkMap& links_to_remove, const std::string& writer_name="undef") @@ -302,16 +302,18 @@ class InputBuffer: public Buffer { //, public boost::enable_shared_from_this<Inp IPAACA_WARNING("(ERROR) InputBuffer::_send_iu_commission() should never be invoked") } protected: - RemoteServerPtr _get_remote_server(const std::string& unique_server_name); - ListenerPtr _create_category_listener_if_needed(const std::string& category); - void _handle_iu_events(EventPtr event); + rsb::patterns::RemoteServerPtr _get_remote_server(const std::string& unique_server_name); + rsb::ListenerPtr _create_category_listener_if_needed(const std::string& category); + void _handle_iu_events(rsb::EventPtr event); protected: + InputBuffer(const std::string& basename, const std::set<std::string>& category_interests); InputBuffer(const std::string& basename, const std::vector<std::string>& category_interests); InputBuffer(const std::string& basename, const std::string& category_interest1); InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2); InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3); InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4); public: + static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::set<std::string>& category_interests); static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::vector<std::string>& category_interests); static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1); static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2); @@ -427,6 +429,8 @@ class Payload//{{{ inline const std::string& owner_name() { return _owner_name; } // access PayloadEntryProxy operator[](const std::string& key); + operator std::map<std::string, std::string>(); + inline void set(const std::map<std::string, std::string>& all_elems) { _internal_replace_all(all_elems); } inline void set(const std::string& k, const std::string& v) { _internal_set(k, v); } inline void remove(const std::string& k) { _internal_remove(k); } std::string get(const std::string& k); @@ -639,6 +643,50 @@ class NotImplementedError: public Exception//{{{ } };//}}} +// additional misc classes ( Command line options )//{{{ +class CommandLineOptions { + public: + inline CommandLineOptions() { } + std::map<std::string, std::string> param_opts; + std::map<std::string, bool> param_set; + public: + void set_option(const std::string& name, bool expect, const char* optarg); + std::string get_param(const std::string& o); + bool is_set(const std::string& o); + void dump(); + typedef boost::shared_ptr<CommandLineOptions> ptr; +}; + +class CommandLineParser { + protected: + std::map<char, std::string> longopt; // letter->name + std::map<std::string, char> shortopt; // letter->name + std::map<std::string, bool> options; // name / expect_param + std::map<std::string, std::string> defaults; // for opt params + std::map<std::string, int> set_flag; // for paramless opts + protected: + CommandLineParser(); + public: + inline ~CommandLineParser() { } + static inline boost::shared_ptr<CommandLineParser> create() { + return boost::shared_ptr<CommandLineParser>(new CommandLineParser()); + } + void initialize_parser_defaults(); + void dump_options(); + void add_option(const std::string& optname, char shortn, bool expect_param, const std::string& defaultv); + void ensure_defaults_in( CommandLineOptions::ptr clo ); + CommandLineOptions::ptr parse(int argc, char* const* argv); + typedef boost::shared_ptr<CommandLineParser> ptr; +}; +//}}} + +// additional misc functions ( String splitting / joining )//{{{ +std::string str_join(const std::set<std::string>& set,const std::string& sep); +std::string str_join(const std::vector<std::string>& vec,const std::string& sep); +void str_split_wipe(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters ); +void str_split_append(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters ); +//}}} + // (snippets) //{{{ /* class IUEventFunctionHandler: public rsb::EventFunctionHandler { diff --git a/ipaacalib/cpp/src/ipaaca-cmdline-parser.cc b/ipaacalib/cpp/src/ipaaca-cmdline-parser.cc new file mode 100644 index 0000000000000000000000000000000000000000..264e561116b2d48ad7abc8587e2f0252fc27eff0 --- /dev/null +++ b/ipaacalib/cpp/src/ipaaca-cmdline-parser.cc @@ -0,0 +1,163 @@ +#include <ipaaca/ipaaca.h> +#include <getopt.h> + +namespace ipaaca { + +// +// Command line options implementation +// + + +void CommandLineOptions::set_option(const std::string& name, bool expect, const char* optarg) { + param_set[name] = true; + if (expect) { + param_opts[name] = optarg; + } +} +std::string CommandLineOptions::get_param(const std::string& o) { + std::map<std::string, std::string>::iterator it = param_opts.find(o); + if (it==param_opts.end()) return ""; + return it->second; +} +bool CommandLineOptions::is_set(const std::string& o) { + std::map<std::string, bool>::iterator it = param_set.find(o); + if (it==param_set.end()) return false; + return it->second; +} +void CommandLineOptions::dump() { + for (std::map<std::string, bool>::iterator it=param_set.begin(); it!=param_set.end(); ++it) { + std::map<std::string, std::string>::iterator it2 = param_opts.find( it->first ); + if (it2 == param_opts.end()) { + std::cout << it->first << "\t<true>" << std::endl; + } else { + std::cout << it->first << "\t" << it2->second << std::endl; + } + } +} + +// +// Command line parser implementation +// + +CommandLineParser::CommandLineParser() +{ + initialize_parser_defaults(); +} + +void CommandLineParser::initialize_parser_defaults() +{ + add_option("help", 0 , false, ""); + add_option("verbose", 'v', false, ""); + add_option("character-name", 'c', true, "UnknownCharacter"); + add_option("component-name", 'n', true, "UnknownComponent"); +} + +void CommandLineParser::dump_options() +{ + for (std::map<std::string, bool>::const_iterator it = options.begin(); it!=options.end(); ++it) { + const std::string& optn = it->first; + bool expect = it->second; + char shortn = shortopt[optn]; + std::string shortns; shortns += shortn; + if (optn != "help") { + if (shortn) std::cout << " -" << shortns << " | --" << optn << " "; + else std::cout << " --" << optn << " "; + if (expect) { + std::cout << "<param>"; + std::cout << " (default: '" << defaults[optn] << "')"; + } + std::cout << std::endl; + } + } +} + +void CommandLineParser::add_option(const std::string& optname, char shortoptn, bool expect_param, const std::string& defaultv) +{ + longopt[shortoptn] = optname; + shortopt[optname] = shortoptn; + options[optname] = expect_param; + defaults[optname] = defaultv; + set_flag[optname] = 0; +} + +CommandLineOptions::ptr CommandLineParser::parse(int argc, char* const* argv) +{ + int len = options.size(); + struct option long_options[len+1]; + int i=0; + std::string short_options_str = ""; + for (std::map<std::string, bool>::const_iterator it = options.begin(); it!=options.end(); ++it) { + const std::string& optn = it->first; + bool expect = it->second; + char shortn = shortopt[optn]; + int* write_to = &(set_flag[optn]); + if (shortn > ' ') { + short_options_str += shortn; + if (expect) short_options_str += ':'; + } + long_options[i].name = optn.c_str(); + long_options[i].has_arg = (expect?required_argument:no_argument); + long_options[i].flag = (expect?write_to:0); + long_options[i].val = shortn; + i++; + } + long_options[i].name = 0; + long_options[i].has_arg = 0; + long_options[i].flag = 0; + long_options[i].val = 0; + CommandLineOptions::ptr clo = CommandLineOptions::ptr(new CommandLineOptions()); + int c; + bool keep_going = true; + while (keep_going) + { + // getopt_long stores the option index here. + int option_index = 0; + c = getopt_long (argc, argv, short_options_str.c_str(), long_options, &option_index); + // Detect the end of the options. + if (c == -1) break; + + switch (c) + { + case 0: + { + std::string longname = long_options[option_index].name; + if (longname == "help") { + std::cout << "Options:" << std::endl; + dump_options(); + exit(0); + } + std::string longoption = long_options[option_index].name; + bool expect = options[longoption]; + clo->set_option(longoption, expect, optarg); + } + break; + + case '?': + break; + + default: + std::string s; + s += c; + std::string longoption = longopt[c]; + bool expect = options[longoption]; + clo->set_option(longoption, expect, optarg); + } + } + ensure_defaults_in( clo ); + return clo; +} + +void CommandLineParser::ensure_defaults_in( CommandLineOptions::ptr clo ) +{ + for (std::map<std::string, bool>::const_iterator it = options.begin(); it!=options.end(); ++it) { + const std::string& optn = it->first; + bool expect = it->second; + char shortn = shortopt[optn]; + if (expect && (! clo->is_set(optn))) { + clo->set_option(optn, true, defaults[optn].c_str()); + } + } +} + +} // namespace ipaaca + diff --git a/ipaacalib/cpp/src/ipaaca-string-utils.cc b/ipaacalib/cpp/src/ipaaca-string-utils.cc new file mode 100644 index 0000000000000000000000000000000000000000..2cc6d38603bd2c39be069f4155d3b0c64dd06999 --- /dev/null +++ b/ipaacalib/cpp/src/ipaaca-string-utils.cc @@ -0,0 +1,71 @@ +#include <ipaaca/ipaaca.h> + +namespace ipaaca { + +std::string str_join(const std::set<std::string>& set,const std::string& sep) +{ + if(set.size()==0) + return ""; + std::string::size_type size=sep.length()*set.size(); + for(std::set<std::string>::const_iterator it = set.begin(); it !=set.end(); it++) + { + size+=(*it).length(); + } + std::string tmp; + tmp.reserve(size); + tmp=*(set.begin()); + std::set<std::string>::const_iterator it = set.begin(); + it++; + for(; it !=set.end(); it++) + { + tmp=tmp+sep+(*it); + } + return tmp; +} + +std::string str_join(const std::vector<std::string>& vec,const std::string& sep) +{ + if(vec.size()==0) + return ""; + std::string::size_type size=sep.length()*vec.size(); + for(unsigned int i=0;i<vec.size();i++) + { + size+=vec[i].length(); + } + std::string tmp; + tmp.reserve(size); + tmp=vec[0]; + for(unsigned int i=1;i<vec.size();i++) + { + tmp=tmp+sep+vec[i]; + } + return tmp; +} + +void str_split_wipe(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters ) +{ + tokens.clear(); + std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); + std::string::size_type pos = str.find_first_of(delimiters, lastPos); + while (std::string::npos != pos || std::string::npos != lastPos) + { + tokens.push_back(str.substr(lastPos, pos - lastPos)); + lastPos = str.find_first_not_of(delimiters, pos); + pos = str.find_first_of(delimiters, lastPos); + } +} +void str_split_append(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters ) +{ + std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); + std::string::size_type pos = str.find_first_of(delimiters, lastPos); + while (std::string::npos != pos || std::string::npos != lastPos) + { + tokens.push_back(str.substr(lastPos, pos - lastPos)); + lastPos = str.find_first_not_of(delimiters, pos); + pos = str.find_first_of(delimiters, lastPos); + } +} + +} // namespace ipaaca + + diff --git a/ipaacalib/cpp/src/ipaaca.cc b/ipaacalib/cpp/src/ipaaca.cc index 8bf68748863437d98325fc24e9fbe377256a3f52..ee4c9ba6921051a4aa466bd27ff132ea4a93d231 100644 --- a/ipaacalib/cpp/src/ipaaca.cc +++ b/ipaacalib/cpp/src/ipaaca.cc @@ -1,8 +1,12 @@ -#include <ipaaca.h> +#include <ipaaca/ipaaca.h> #include <cstdlib> namespace ipaaca { +using namespace rsb; +using namespace rsb::filter; +using namespace rsb::converter; +using namespace rsb::patterns; // util and init//{{{ @@ -472,6 +476,13 @@ void OutputBuffer::_retract_iu(IU::ptr iu) //}}} // InputBuffer//{{{ +InputBuffer::InputBuffer(const std::string& basename, const std::set<std::string>& category_interests) +:Buffer(basename, "IB") +{ + for (std::set<std::string>::const_iterator it=category_interests.begin(); it!=category_interests.end(); ++it) { + _create_category_listener_if_needed(*it); + } +} InputBuffer::InputBuffer(const std::string& basename, const std::vector<std::string>& category_interests) :Buffer(basename, "IB") { @@ -507,6 +518,11 @@ InputBuffer::InputBuffer(const std::string& basename, const std::string& categor } +InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::set<std::string>& category_interests) +{ + Initializer::initialize_ipaaca_rsb_if_needed(); + return InputBuffer::ptr(new InputBuffer(basename, category_interests)); +} InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::vector<std::string>& category_interests) { Initializer::initialize_ipaaca_rsb_if_needed(); @@ -978,6 +994,10 @@ PayloadEntryProxy Payload::operator[](const std::string& key) //boost::shared_ptr<PayloadEntryProxy> p(new PayloadEntryProxy(this, key)); return PayloadEntryProxy(this, key); } +Payload::operator std::map<std::string, std::string>() +{ + return _store; +} inline void Payload::_internal_set(const std::string& k, const std::string& v, const std::string& writer_name) { std::map<std::string, std::string> _new; diff --git a/ipaacalib/java/build.xml b/ipaacalib/java/build.xml index 7ad2914a263dead1341a2bd0f8f42f154e363792..581db9b78854b8800a484ff91783832f1fb2eb67 100644 --- a/ipaacalib/java/build.xml +++ b/ipaacalib/java/build.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="ipaaca-java" default="run"> - <import file="../../../soashared/ant/build.xml" /> + <import file="../../../hmibuild/build.xml" /> <!-- import file="../../../HmiBuild/build.xml" / --> <target name="-pre-compilation"> diff --git a/ipaacalib/java/manifest.mf b/ipaacalib/java/manifest.mf index a38fbbdd8ecb3f632efa6a6d8d2b3d55fa394ef6..bd2397be05ff81088ca51c679d46422d18327d47 100644 --- a/ipaacalib/java/manifest.mf +++ b/ipaacalib/java/manifest.mf @@ -6,5 +6,5 @@ Specification-Title: IpaacaJava Specification-Version: 0.1 Specification-Vendor: ipaaca Implementation-Title: IpaacaJava -Implementation-Version: July 27 2012 02:19 PM +Implementation-Version: August 02 2012 01:27 PM Implementation-Vendor: ipaaca \ No newline at end of file diff --git a/ipaacalib/python/build.xml b/ipaacalib/python/build.xml index 2e5c1284bc55d3d90071942617aaf4d903289564..3a19cf5d85bb6f0d0f1127ca02950e2ac7bddd46 100644 --- a/ipaacalib/python/build.xml +++ b/ipaacalib/python/build.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="IpaacaPython" default="run"> - <import file="../../../soashared/ant/build.xml" /> + <import file="../../../hmibuild/build.xml" /> <!--import file="../../../HmiBuild/build.xml" / --> <target name="-pre-compilation"> <echo message="Compiling protobuf file" /> diff --git a/ipaacalib/python/src/ipaaca.py b/ipaacalib/python/src/ipaaca.py index af8f3f5ce953956297b70f577998c6a03775ee62..48263ac49236342d30215bc8b846109162cb7c8b 100755 --- a/ipaacalib/python/src/ipaaca.py +++ b/ipaacalib/python/src/ipaaca.py @@ -790,7 +790,7 @@ class Buffer(object): ''' super(Buffer, self).__init__() self._owning_component_name = owning_component_name - self._participant_config = participant_config #rsb.ParticipantConfig.fromDefaultSources() if participant_config is None else participant_config + self._participant_config = rsb.ParticipantConfig.fromDefaultSources() if participant_config is None else participant_config self._uuid = str(uuid.uuid4())[0:8] # Initialise with a temporary, but already unique, name self._unique_name = "undef-"+self._uuid diff --git a/ipaacasoa/build.xml b/ipaacasoa/build.xml new file mode 100644 index 0000000000000000000000000000000000000000..0101c14baf9ca0cc07c15f13fabf0e6e3214c4cc --- /dev/null +++ b/ipaacasoa/build.xml @@ -0,0 +1,3 @@ +<project name="IpaacaSoa" default="build" basedir="."> + <import file="../../hmibuild/build-recurse.xml" /> +</project> diff --git a/ipaacasoa/cpp/CMakeLists.txt b/ipaacasoa/cpp/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9830e75d75edd7b6322c9bdaf7e1b59d942a70a9 --- /dev/null +++ b/ipaacasoa/cpp/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 2.6) + +# project name +project (ipaaca_soa_cpp) + +install( + DIRECTORY include + DESTINATION / + FILES_MATCHING PATTERN "*.h" PATTERN "*.hh" PATTERN "*.hpp" PATTERN "*.inl" + ) + diff --git a/ipaacasoa/cpp/build.properties b/ipaacasoa/cpp/build.properties new file mode 100644 index 0000000000000000000000000000000000000000..4c98f5813b7e9452ee96f492206ffe299132b005 --- /dev/null +++ b/ipaacasoa/cpp/build.properties @@ -0,0 +1,6 @@ +language=cpp +resolve.status=beta +resource.path=${shared.resources}/; +rebuild.list= +dist.dir=../../dist + diff --git a/ipaacasoa/cpp/build.xml b/ipaacasoa/cpp/build.xml new file mode 100644 index 0000000000000000000000000000000000000000..eea2c0d47ef3720b305e07023c830f62a3e10e7f --- /dev/null +++ b/ipaacasoa/cpp/build.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="IpaacaSoaCpp" default="dist"> + <import file="../../../hmibuild/build.xml" /> +</project> + diff --git a/ipaacasoa/cpp/include/ipaaca-soa/categories_components_lexicon.h b/ipaacasoa/cpp/include/ipaaca-soa/categories_components_lexicon.h new file mode 100644 index 0000000000000000000000000000000000000000..773c34340179f3e78a5e422cbf5c73ff525e452a --- /dev/null +++ b/ipaacasoa/cpp/include/ipaaca-soa/categories_components_lexicon.h @@ -0,0 +1,140 @@ +/* + * Common Categories and Components macros for ipaaca C++ projects + * + * ported from ipaaca1 + */ + +#ifndef CATEGORIES_COMPONENTS_LEXICON_H_ +#define CATEGORIES_COMPONENTS_LEXICON_H_ + +#include <string> + +// +// Categories +// +// please indicate sub-categories (e.g. component-specific data) and/or add descriptions + +/// execution request for MURML string +const std::string CAT__MURML_DATA = "murmldata"; +const std::string CAT__MURML_FILE = "murmlfile"; + +/// debugging (e.g. producing faults at will; messaging; logging) +const std::string CAT__DEBUGGING = "debugging"; + +/// Result from speech recognition +const std::string CAT__ASR_RESULT = "asrresult"; + +/// STOP (Interrupt current behaviors) +const std::string CAT__STOP_BEHAVIOR = "stopbehavior"; + +/// request to Mary TTS client +const std::string CAT__MARYTTSREQUEST = "maryttsrequest"; +/// answer from Mary TTS client +const std::string CAT__MARYTTSREPLY = "maryttsreply"; +/// TTS info IU (is speech in progress? when will it end? etc.) +const std::string CAT__MARYTTSINFO = "maryttsinfo"; + +/// WIImote controller input +const std::string CAT__CONTROLLER_WII = "wiiinput"; + + +/// (OgreCalendar:) sending updates to GUI calendar +const std::string CAT__CALENDAR_CONTROL = "calendarcontrol"; +/// (OgreCanvas:) sending updates to generic Canvas component +const std::string CAT__CANVAS_CONTROL = "canvascontrol"; +/// (OgreVideoCall:) sending control commands to the video call component +const std::string CAT__VIDEOCALL_CONTROL = "videocallcontrol"; +/// (OgreTrafficLight:) sending updates to GUI traffic light +const std::string CAT__TRAFFIC_LIGHT_CONTROL = "trafficlightcontrol"; + + +/// Data from 2012 Dialogue Demonstrator XCF bridge +const std::string CAT__XCF_BRIDGE = "xcfbridge"; + +/// Data from old (2010) Wizard-of-Oz GUI +const std::string CAT__GUI_DATA = "guidata"; + + +/// SCH3 Vince (from Schnick-Schnack-Schnuck / Rock-Paper-Scissors) +const std::string CAT__SCH3_GESTURE = "sch3gesture"; +const std::string CAT__SCH3_OPTIONS = "sch3options"; + + +// +// UNDOCUMENTED CATEGORIES +// +// --- YET TO BE DOCUMENTED ! --- +// +// Please no not add new categories to this section! +// +const std::string CAT__PERCEPTION_MESSAGE = "perceptionmessage"; +const std::string CAT__PERCEPTION_WRISTS = "perceptionwristspositions"; +const std::string CAT__PERCEPTION_HEIGHT = "perceptionheight"; +const std::string CAT__PERCEPTION_HEIGHT_REQ = "perceptionheightreq"; +const std::string CAT__PERCEPTION_CENTEROFMASS = "perceptioncenterofmass"; +const std::string CAT__PERCEPTION_CENTEROFMASS_REQ = "perceptioncenterofmassreq"; +const std::string CAT__CONTROLLER_COGNITIVEPROCESS = "controllercognitiveprocess"; +const std::string CAT__GENERATION_WRISTS = "generationwrists"; +const std::string CAT__GENERATION_MP = "generationmp"; +const std::string CAT__GENERATION_GUIDING_SEQUENCE = "generationgss"; +const std::string CAT__IK_GENERATION_WRISTS = "ikgenerationwrists"; +const std::string CAT__SELF_COLLISION_SETTINGS = "selfcollisionsettings"; +const std::string CAT__MOTORBODY_NOTIFICATION = "motorbodynotification"; +const std::string CAT__SMKM_MOTOR_KNOWLEDGE = "smkmmotorknowledge"; +const std::string CAT__SMKM_PARAMETERS = "smkmparameters"; +const std::string CAT__SMKM_MENU = "smkmmenu"; +const std::string CAT__SMKM_PARAMETER_ASSIGNMENT = "smkmparameterassignment"; +const std::string CAT__SMKM_USER_MESSAGE = "smkmusermessage"; +const std::string CAT__SECONDARY_BEHAVIOR = "secondarybehavior"; +const std::string CAT__SMKM_WAVING = "smkmuserwaving"; +const std::string CAT__SMKM_RESET = "resetforsmkmmodel"; +const std::string CAT__SMKM_BRAIN_MODE = "smkmbrainmode"; +const std::string CAT__SMKM_DROPPED_MP_HYPOS = "droppedmphyposnames"; +const std::string CAT__DM_ASR_LABEL = "dialogmanagerasrlabel"; +const std::string CAT__DM_SMKM_BRAIN_MODE = "dialogmanagersmkmbrainmode"; +const std::string CAT__VISUALIZE_OBSERVED_WRISTS = "visualizeobservedwrists"; +const std::string CAT__HYPOTHESES_VISUALIZATION = "hypothesesvisualization"; +const std::string CAT__TRAJECTORY_VISUALIZATION = "trajectoryvisualization"; +const std::string CAT__BELIEF_PROBABILITY_VISUALIZATION = "beliefprobabilityvisualization"; +const std::string CAT__BELIEF_PROBABILITY_DISTRIBUTION = "beliefprobabilitydistribution"; +const std::string CAT__RESET_PROBABILITY_DISTRIBUTION = "resetprobabilitydistribution"; +const std::string CAT__ACE_FIGURE_TFM_MATRIX = "acetfmmatrix"; +const std::string CAT__ACE_FIGURE_TFM_MATRIX_REQ = "acetfmmatrixreq"; +const std::string CAT__SHOW_IMAGE = "showimage"; +const std::string CAT__FOCUS_ON_IMAGE = "focusonimage"; +const std::string CAT__GENERATE_GESTURE = "generategesture"; +const std::string CAT__DELETE_GESTURE = "deletegesture"; +const std::string CAT__CHANGE_OBSERVATION_FREQUENCY = "changeobservationfrequency"; +const std::string CAT__DM_NUMBER_OF_GESTURES_REQ = "reqnumberofgestures"; +const std::string CAT__DM_NUMBER_OF_GESTURES = "reqnumberofgestures"; +const std::string CAT__TEXT_TO_SPEECH = "texttospeech"; +const std::string CAT__OGRE_MODIFICATION_COMMAND = "ogremodificationcmd"; +const std::string CAT__GESTURE_RESULT = "gestureresult"; +const std::string CAT__DIALOGMANAGER_GESTURE_LEARNING = "gesturelearning"; +const std::string CAT__RETRACT = "postureretraction"; +const std::string CAT__BELIEF_PROBABILITY = "beliefprobability"; +// End of UNDOCUMENTED CATEGORIES +// Please do not add to this section, add new categories (with /// docstring) +// to the paragraph preceding this undocumented section + + + + + +// (Old definitions from ipaaca1:) +// +// Well-known Component names +// +const std::string COM__MARYTTS = "MaryTTS"; +const std::string COM__WII_CONTROLLER = "WiiController"; +const std::string COM__TEXT_INPUT = "TextInput"; +const std::string COM__CSV_SENDER = "CSVSender"; +const std::string COM__OGRE_CALENDAR = "OgreCalendar"; +const std::string COM__OGRE_TRAFFIC_LIGHT = "OgreTrafficLight"; +const std::string COM__SHARED_MOTOR_KNOWLEDGE_MODEL = "SharedMotorKnowledgeModel"; +const std::string COM__DIALOG_MANAGER = "DialogManager_CPP"; +const std::string COM__SCH3_DIALOGMANAGER = "SCH3DialogManager"; +const std::string COM__SCH3_GESTUREPERFORMER = "SCH3GesturePerformer"; + + +#endif /* CATEGORIES_COMPONENTS_LEXICON_H_ */ diff --git a/ipaacasoa/cpp/ivy.xml b/ipaacasoa/cpp/ivy.xml new file mode 100644 index 0000000000000000000000000000000000000000..0564e28ddb12f6fca6464af1ee56b3fed8d6faaf --- /dev/null +++ b/ipaacasoa/cpp/ivy.xml @@ -0,0 +1,5 @@ +<ivy-module version="2.0"> + <info organisation="SOA" module="IpaacaSoaCpp" /> + <dependencies> + </dependencies> +</ivy-module> diff --git a/ipaacatools/build.xml b/ipaacatools/build.xml index 7a9d03886e755a80c15bb8e61a8ebce633438577..3791c270eafb6df411f5ab2082d7e4d6dacf5cb9 100644 --- a/ipaacatools/build.xml +++ b/ipaacatools/build.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="IpaacaTools" default="dist"> - <import file="../../soashared/ant/build.xml" /> + <import file="../../hmibuild/build.xml" /> </project> diff --git a/ipaacatools/scripts/ipaaca-iu-injector.py b/ipaacatools/scripts/ipaaca-iu-injector.py new file mode 100755 index 0000000000000000000000000000000000000000..102a3c5440e42964c40abc1f209625e688cc0cfe --- /dev/null +++ b/ipaacatools/scripts/ipaaca-iu-injector.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import time +import logging +import ipaaca + +def my_update_handler(iu, event_type, local): + print(event_type+': '+str(iu)) + +ob = ipaaca.OutputBuffer('CoolInformerOut') +ob.register_handler(my_update_handler) + +iu_top = ipaaca.IU('murmlfile') +iu_top.payload = {'data': 'HalloTest.us'} +#iu_top.payload = {'data': 'smile_7sec.us'} +ob.add(iu_top) + +time.sleep(1) +print "Done" + diff --git a/ipaacatools/scripts/ipaaca-iu-sniffer.py b/ipaacatools/scripts/ipaaca-iu-sniffer.py new file mode 100755 index 0000000000000000000000000000000000000000..c810ec868d6b00932b8c73b9ab66c8ec6db1e9f0 --- /dev/null +++ b/ipaacatools/scripts/ipaaca-iu-sniffer.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import time +import logging +import ipaaca + +def my_update_handler(iu, event_type, local): + print(event_type+': '+str(iu)) + +ib = ipaaca.InputBuffer('SnifferIn', ['']) +ib.register_handler(my_update_handler) + +while True: + print(" .") + time.sleep(1) + diff --git a/resolve.sh b/resolve.sh new file mode 100755 index 0000000000000000000000000000000000000000..4802315eda0aaa7bd53d8e91bc25cd8df96b488d --- /dev/null +++ b/resolve.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +PACKAGES="rsb" + +mkdir -p deps/bin +mkdir -p deps/lib +mkdir -p deps/include +mkdir -p deps/scripts +for P in $PACKAGES; do + cp -a ../$P/dist/bin/* deps/bin/ + cp -a ../$P/dist/lib/* deps/lib/ + cp -a ../$P/dist/include/* deps/include/ + cp -a ../$P/dist/scripts/* deps/scripts/ +done +