RTno is communicating library and framework which allows you to make your embedded device capable of communicating with RT-middleware world. RT-middleware is a platform software to realize Robotic system. In RTM, robots are developed by constructing robotics technologies\' elements (components) named RT-component. Therefore, the RTno helps you to create your own RT-component with your mbed and arduino. To know how to use your RTno device, visit here: http://ysuga.net/robot_e/rtm_e/rtc_e/1065?lang=en To know about RT-middleware and RT-component, visit http://www.openrtm.org
Dependencies: EthernetInterface mbed-rtos
Diff: Sequence.h
- Revision:
- 0:5f7bc45bc2e8
diff -r 000000000000 -r 5f7bc45bc2e8 Sequence.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sequence.h Mon Jun 24 06:42:11 2013 +0000 @@ -0,0 +1,45 @@ +#ifndef SEQUENCE_HEADER_INCLUDED +#define SEQUENCE_HEADER_INCLUDED + +#include <stdint.h> +#include <stdlib.h> + +class SequenceBase { + protected: + uint8_t m_length; + + public: + virtual uint8_t length() { + return m_length; + } + + virtual void length(uint8_t len) {}; + + virtual void* getData() = 0; +}; + + +template<typename T> +class Sequence : public SequenceBase { + T *m_ptr; + + public: + Sequence() {m_ptr = 0;} + virtual void length(uint8_t len) { + m_length = len; + free((void*)m_ptr); + m_ptr = (T*)malloc(len * sizeof(T)); + } + + virtual uint8_t length() { + return SequenceBase::length(); + } + T& operator[](uint8_t index) { + return m_ptr[index]; + } + + virtual void* getData() { return m_ptr; } +}; + + +#endif //#ifndef SEQUENCE_HEADER_INCLUDED