1234567891011121314151617181920212223242526272829303132333435 |
- #ifndef TYPEBUFFER_H
- #define TYPEBUFFER_H
- #include <iostream>
- #include "data/List.h"
- template<typename T>
- class TypedBuffer {
- List<T> data;
- public:
- TypedBuffer& add(const T& t) {
- data.add(t);
- return *this;
- }
- int getLength() const {
- return data.getLength();
- }
- int getByteLength() const {
- return data.getLength() * static_cast<int>(sizeof(T));
- }
- operator const T*() const {
- return data.begin();
- }
- void clear() {
- data.clear();
- }
- };
- #endif
|