Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* buffer: stub out
- Loading branch information
Showing
4 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef _SRC_BINDINGS_BUFFER_H_ | ||
#define _SRC_BINDINGS_BUFFER_H_ | ||
|
||
#include <candor.h> | ||
#include <sys/types.h> // size_t | ||
#include <stdlib.h> // NULL | ||
|
||
namespace can { | ||
|
||
class Buffer : public candor::CWrapper { | ||
public: | ||
Buffer(size_t size) : candor::CWrapper(&magic), size_(size) { | ||
data_ = new char[size]; | ||
} | ||
|
||
~Buffer() { | ||
delete[] data_; | ||
data_ = NULL; | ||
} | ||
|
||
inline char* data() { return data_; } | ||
inline size_t size() { return size_; } | ||
|
||
static void New(uint32_t argc, candor::Value** argv); | ||
static void Init(candor::Object* target); | ||
|
||
// Magic word | ||
static const int magic; | ||
|
||
protected: | ||
char* data_; | ||
size_t size_; | ||
}; | ||
|
||
} // namespace can | ||
|
||
#endif // _SRC_BINDINGS_BUFFER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters