From 17dc0febb17888015be1e4ad1ed4b096a4909865 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Thu, 19 Mar 2015 20:12:11 +0000 Subject: Gem 206d71791bc3642e8c5391a4c59c30ba7411fab8 osx/i386 built 'master:206d71791bc3642e8c5391a4c59c30ba7411fab8' for osx/i386 --- Gem/develop/include/Gem/RTE/Array.h | 51 +++++++++ Gem/develop/include/Gem/RTE/MessageCallbacks.h | 151 +++++++++++++++++++++++++ Gem/develop/include/Gem/RTE/RTE.h | 56 +++++++++ 3 files changed, 258 insertions(+) create mode 100644 Gem/develop/include/Gem/RTE/Array.h create mode 100644 Gem/develop/include/Gem/RTE/MessageCallbacks.h create mode 100644 Gem/develop/include/Gem/RTE/RTE.h (limited to 'Gem/develop/include/Gem/RTE') diff --git a/Gem/develop/include/Gem/RTE/Array.h b/Gem/develop/include/Gem/RTE/Array.h new file mode 100644 index 0000000..6546266 --- /dev/null +++ b/Gem/develop/include/Gem/RTE/Array.h @@ -0,0 +1,51 @@ +/*----------------------------------------------------------------- + LOG + GEM - Graphics Environment for Multimedia + + access arrays of the RTE + + Copyright (c) 2010-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at + For information on usage and redistribution, and for a DISCLAIMER OF ALL + WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + + -----------------------------------------------------------------*/ +#ifndef _INCLUDE__GEM_RTE_ARRAY_H_ +#define _INCLUDE__GEM_RTE_ARRAY_H_ + + +#include "Gem/ExportDef.h" +#include + +namespace gem { + namespace RTE { + class GEM_EXTERN Array { + private: + class PIMPL; + PIMPL*m_pimpl; + + public: + Array(void); + Array(const gem::RTE::Array&a); + Array(const std::string&name); + + virtual ~Array(void); + + /* check whether we hold a valid reference to an array */ + virtual bool isValid(); + + /* reference another array */ + virtual bool name(const std::string&s); + virtual const std::string name(void); + + virtual bool resize(const size_t newsize); + virtual size_t size(void); + + virtual t_float&operator[](const unsigned int&index); + + virtual void set(const t_float f); + + virtual Array&operator=(const Array&); + }; + }; +}; +#endif /* _INCLUDE__GEM_RTE_ARRAY_H_ */ diff --git a/Gem/develop/include/Gem/RTE/MessageCallbacks.h b/Gem/develop/include/Gem/RTE/MessageCallbacks.h new file mode 100644 index 0000000..b4df71b --- /dev/null +++ b/Gem/develop/include/Gem/RTE/MessageCallbacks.h @@ -0,0 +1,151 @@ +/*----------------------------------------------------------------- + LOG + GEM - Graphics Environment for Multimedia + + helper-functions¯os for message callbacks to objects + + Copyright (c) 2010-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at + For information on usage and redistribution, and for a DISCLAIMER OF ALL + WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + + -----------------------------------------------------------------*/ + +// these utility macros warp the callback functions from the RTE, no need add them to your headers! + +// NOTE: this is very experimental; you should not include this header unless you know what you are doing +// once this has proven to work (test on M$VC!), it is likely to be included automatically + +/* usage: + * void myclass::obj_setupCallback(t_class*classPtr) { + * CPPEXTERN_MSG (classPtr, "foo", gimmeMess); // A_GIMME + * CPPEXTERN_MSG0(classPtr, "doit", bangMess); // no args + * CPPEXTERN_MSG1(classPtr, "name", nameMess, t_symbol*); // 1 arg (A_SYMBOL) + * CPPEXTERN_MSG1(classPtr, "title", titleMess, std::string); // 1 arg (A_SYMBOL) + * CPPEXTERN_MSG3(classPtr, "values", tripletMess, t_float, t_float, t_float); // 3 args (A_FLOAT) + * } + * void myclass::gimmeMess (t_symbol*s, int argc, t_atom*argv) {;} + * void myclass::bangMess (void) {;} + * void myclass::nameMess (t_symbol*s) {;} + * void myclass::titleMess (std::string s) {;} + * void myclass::tripletMess(t_float a, t_float b, t_float c) {;} + */ +#ifndef _INCLUDE__GEM_RTE_MESSAGECALLBACKS_H_ +#define _INCLUDE__GEM_RTE_MESSAGECALLBACKS_H_ + +namespace gem { + namespace RteMess { + class NoneType {}; // just a dummy class + template + struct TypeTemplateCore{ + static t_atomtype atomtype_id(void) { return A_NULL; } + static T1 cast(T value) { return static_cast(value); } + typedef T proxyType; + virtual ~TypeTemplateCore(void) { } + }; + template + struct TypeTemplate : TypeTemplateCore { + }; + template<> + struct TypeTemplate : TypeTemplateCore { + static t_atomtype atomtype_id(void) { return A_FLOAT; } + }; + template<> + struct TypeTemplate : TypeTemplateCore { + static t_atomtype atomtype_id(void) { return A_FLOAT; } + }; + template<> + struct TypeTemplate : TypeTemplateCore { + static t_atomtype atomtype_id(void) { return A_FLOAT; } + }; + template<> + struct TypeTemplate : TypeTemplateCore { + static t_atomtype atomtype_id(void) { return A_FLOAT; } + }; + template<> + struct TypeTemplate : TypeTemplateCore { + static t_atomtype atomtype_id(void) { return A_FLOAT; } + static unsigned int cast(t_float f) { return (f>0.)?static_cast(f):0; } + }; + template<> + struct TypeTemplate : TypeTemplateCore { + static t_atomtype atomtype_id(void) { return A_FLOAT; } + static bool cast(t_float f) {return (f>0.5); } + }; + template<> + struct TypeTemplate : TypeTemplateCore { + static t_atomtype atomtype_id(void) { return A_DEFSYMBOL; } + }; + template<> + struct TypeTemplate : TypeTemplateCore { + static t_atomtype atomtype_id(void) { return A_DEFSYMBOL; } + static std::string cast(t_symbol*s) {return std::string(s->s_name); } + }; + }; }; +#define MSG_CONCAT3(a, b, c) _##a##_##b##_##c + + + + +#define CPPEXTERN_MSG_(line, cp, selector, fun) \ + struct MSG_CONCAT3(CallbackClass, fun, line) { \ + static void callback(void*data, t_symbol*s, int argc, t_atom*argv) { GetMyClass(data)->fun(s, argc, argv); } \ + MSG_CONCAT3(CallbackClass, fun, line) (t_class*c, std::string s) { class_addmethod(c, reinterpret_cast(callback), gensym(s.c_str()), A_GIMME, A_NULL); } \ + }; \ + MSG_CONCAT3(CallbackClass, fun, line) MSG_CONCAT3(CallbackClassInstance, fun, line) (cp, selector) +#define CPPEXTERN_MSG0_(line, cp, selector, fun) \ + struct MSG_CONCAT3(CallbackClass, fun, line) { \ + static void callback(void*data) { GetMyClass(data)->fun(); } \ + MSG_CONCAT3(CallbackClass, fun, line) (t_class*c, std::string s) { class_addmethod(c, reinterpret_cast(callback), gensym(s.c_str()), A_NULL); } \ + }; \ + MSG_CONCAT3(CallbackClass, fun, line) MSG_CONCAT3(CallbackClassInstance, fun, line) (cp, selector) +#define CPPEXTERN_MSG1_(line, cp, selector, fun, typ0) \ + struct MSG_CONCAT3(CallbackClass, fun, line) { \ + static void callback(void*data, gem::RteMess::TypeTemplate::proxyType v0) \ + { GetMyClass(data)->fun(gem::RteMess::TypeTemplate::cast(v0)); } \ + MSG_CONCAT3(CallbackClass, fun, line) (t_class*c, std::string s) { class_addmethod(c, reinterpret_cast(callback), gensym(s.c_str()), ("symbol"==s)?A_SYMBOL:(gem::RteMess::TypeTemplate::atomtype_id()), A_NULL); } \ + }; \ + MSG_CONCAT3(CallbackClass, fun, line) MSG_CONCAT3(CallbackClassInstance, fun, line) (cp, selector) +#define CPPEXTERN_MSG2_(line, cp, selector, fun, typ0, typ1) \ + struct MSG_CONCAT3(CallbackClass, fun, line) { \ + static void callback(void*data, gem::RteMess::TypeTemplate::proxyType v0, gem::RteMess::TypeTemplate::proxyType v1) \ + { GetMyClass(data)->fun(gem::RteMess::TypeTemplate::cast(v0), gem::RteMess::TypeTemplate::cast(v1)); } \ + MSG_CONCAT3(CallbackClass, fun, line) (t_class*c, std::string s) { class_addmethod(c, reinterpret_cast(callback), gensym(s.c_str()), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), A_NULL); } \ + }; \ + MSG_CONCAT3(CallbackClass, fun, line) MSG_CONCAT3(CallbackClassInstance, fun, line) (cp, selector) + +#define CPPEXTERN_MSG3_(line, cp, selector, fun, typ0, typ1, typ2) \ + struct MSG_CONCAT3(CallbackClass, fun, line) { \ + static void callback(void*data, gem::RteMess::TypeTemplate::proxyType v0, gem::RteMess::TypeTemplate::proxyType v1, gem::RteMess::TypeTemplate::proxyType v2) \ + { GetMyClass(data)->fun(gem::RteMess::TypeTemplate::cast(v0), gem::RteMess::TypeTemplate::cast(v1), gem::RteMess::TypeTemplate::cast(v2)); } \ + MSG_CONCAT3(CallbackClass, fun, line) (t_class*c, std::string s) { class_addmethod(c, reinterpret_cast(callback), gensym(s.c_str()), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), A_NULL); } \ + }; \ + MSG_CONCAT3(CallbackClass, fun, line) MSG_CONCAT3(CallbackClassInstance, fun, line) (cp, selector) + +#define CPPEXTERN_MSG4_(line, cp, selector, fun, typ0, typ1, typ2, typ3) \ + struct MSG_CONCAT3(CallbackClass, fun, line) { \ + static void callback(void*data, gem::RteMess::TypeTemplate::proxyType v0, gem::RteMess::TypeTemplate::proxyType v1, gem::RteMess::TypeTemplate::proxyType v2, gem::RteMess::TypeTemplate::proxyType v3) \ + { GetMyClass(data)->fun(gem::RteMess::TypeTemplate::cast(v0), gem::RteMess::TypeTemplate::cast(v1), gem::RteMess::TypeTemplate::cast(v2), gem::RteMess::TypeTemplate::cast(v3)); } \ + MSG_CONCAT3(CallbackClass, fun, line) (t_class*c, std::string s) { class_addmethod(c, reinterpret_cast(callback), gensym(s.c_str()), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), A_NULL); } \ + }; \ + MSG_CONCAT3(CallbackClass, fun, line) MSG_CONCAT3(CallbackClassInstance, fun, line) (cp, selector) +#define CPPEXTERN_MSG5_(line, cp, selector, fun, typ0, typ1, typ2, typ3, typ4) \ + struct MSG_CONCAT3(CallbackClass, fun, line) { \ + static void callback(void*data, gem::RteMess::TypeTemplate::proxyType v0, gem::RteMess::TypeTemplate::proxyType v1, gem::RteMess::TypeTemplate::proxyType v2, gem::RteMess::TypeTemplate::proxyType v3, gem::RteMess::TypeTemplate::proxyType v4) \ + { GetMyClass(data)->fun(gem::RteMess::TypeTemplate::cast(v0), gem::RteMess::TypeTemplate::cast(v1), gem::RteMess::TypeTemplate::cast(v2), gem::RteMess::TypeTemplate::cast(v3), gem::RteMess::TypeTemplate::cast(v4)); } \ + MSG_CONCAT3(CallbackClass, fun, line) (t_class*c, std::string s) { class_addmethod(c, reinterpret_cast(callback), gensym(s.c_str()), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), gem::RteMess::TypeTemplate::atomtype_id(), A_NULL); } \ + }; \ + MSG_CONCAT3(CallbackClass, fun, line) MSG_CONCAT3(CallbackClassInstance, fun, line) (cp, selector) + + +#define CPPEXTERN_MSG(cp, selector, fun) CPPEXTERN_MSG_ ( __LINE__ , cp, selector, fun) +#define CPPEXTERN_MSG0(cp, selector, fun) CPPEXTERN_MSG0_ ( __LINE__ , cp, selector, fun) +#define CPPEXTERN_MSG1(cp, selector, fun, typ) CPPEXTERN_MSG1_ ( __LINE__ , cp, selector, fun, typ) +#define CPPEXTERN_MSG2(cp, selector, fun, typ0, typ1) CPPEXTERN_MSG2_ ( __LINE__ , cp, selector, fun, typ0, typ1) +#define CPPEXTERN_MSG3(cp, selector, fun, typ0, typ1, typ2) CPPEXTERN_MSG3_ ( __LINE__ , cp, selector, fun, typ0, typ1, typ2) +#define CPPEXTERN_MSG4(cp, selector, fun, typ0, typ1, typ2, typ3) CPPEXTERN_MSG4_ ( __LINE__ , cp, selector, fun, typ0, typ1, typ2, typ3) +#define CPPEXTERN_MSG5(cp, selector, fun, typ0, typ1, typ2, typ3, typ4) CPPEXTERN_MSG5_ ( __LINE__ , cp, selector, fun, typ0, typ1, typ2, typ3, typ4) + + + + +#endif /* _INCLUDE__GEM_RTE_MESSAGECALLBACKS_H_ */ diff --git a/Gem/develop/include/Gem/RTE/RTE.h b/Gem/develop/include/Gem/RTE/RTE.h new file mode 100644 index 0000000..bbcad94 --- /dev/null +++ b/Gem/develop/include/Gem/RTE/RTE.h @@ -0,0 +1,56 @@ +/*----------------------------------------------------------------- + LOG + GEM - Graphics Environment for Multimedia + + generic access to RTE + + Copyright (c) 2012 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at + For information on usage and redistribution, and for a DISCLAIMER OF ALL + WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + + -----------------------------------------------------------------*/ +#ifndef _INCLUDE__GEM_RTE_RTE_H_ +#define _INCLUDE__GEM_RTE_RTE_H_ + + +#include "Gem/ExportDef.h" +#include + +namespace gem { + namespace RTE { + class GEM_EXTERN RTE { + private: + class PIMPL; + PIMPL*m_pimpl; + + RTE(void); + virtual ~RTE(void); + + public: + static RTE*getRuntimeEnvironment(void); + + /** + * get the Runtime Environemnt's version + */ + virtual const std::string getVersion(unsigned int&major, unsigned int&minor); + + /** + * get the Runtime Environemnt's name + */ + virtual const std::string getName(void); + + /** + * resolve a function-name in the current RTE + * @return pointer to the function named 'name', or NULL if it doesn't exist + */ + virtual void*getFunction(const std::string&name); + + /** + * find a file in the given context(canvas), searching RTEs search paths + * @return expanded filename + */ + virtual std::string findFile(const std::string&name, const std::string&ext, const void*context) const; + }; + }; +}; +#endif /* _INCLUDE__GEM_RTE_RTE_H_ */ -- cgit v1.2.1