00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "Core/precomp.h"
00015 #include <API/Core/IOData/outputsource_memory.h>
00016 #include <API/Core/System/cl_assert.h>
00017
00018 CL_OutputSource_Memory::CL_OutputSource_Memory()
00019 {
00020 m_pos = 0;
00021 }
00022
00023 CL_OutputSource_Memory::~CL_OutputSource_Memory()
00024 {
00025 }
00026
00027 std::string CL_OutputSource_Memory::get_data() const
00028 {
00029 return m_data;
00030 }
00031
00032 void CL_OutputSource_Memory::set_system_mode()
00033 {
00034 cl_assert(false);
00035 }
00036
00037 void CL_OutputSource_Memory::set_big_endian_mode()
00038 {
00039 cl_assert(false);
00040 }
00041
00042 void CL_OutputSource_Memory::set_little_endian_mode()
00043 {
00044 cl_assert(false);
00045 }
00046
00047 void CL_OutputSource_Memory::write_int32(int data)
00048 {
00049 write(&data, sizeof(int));
00050 }
00051
00052 void CL_OutputSource_Memory::write_uint32(unsigned int data)
00053 {
00054 write(&data, sizeof(unsigned int));
00055 }
00056
00057 void CL_OutputSource_Memory::write_short16(short data)
00058 {
00059 write(&data, sizeof(short));
00060 }
00061
00062 void CL_OutputSource_Memory::write_ushort16(unsigned short data)
00063 {
00064 write(&data, sizeof(unsigned short));
00065 }
00066
00067 void CL_OutputSource_Memory::write_char8(char data)
00068 {
00069 write(&data, sizeof(char));
00070 }
00071
00072 void CL_OutputSource_Memory::write_uchar8(unsigned char data)
00073 {
00074 write(&data, sizeof(unsigned char));
00075 }
00076
00077 void CL_OutputSource_Memory::write_float32(float data)
00078 {
00079 write(&data, sizeof(float));
00080 }
00081
00082 void CL_OutputSource_Memory::write_bool(bool data)
00083 {
00084 write(&data, sizeof(bool));
00085 }
00086
00087 int CL_OutputSource_Memory::write(const void *data, int size)
00088 {
00089 m_data.append((const char *) data, size);
00090 m_pos += size;
00091
00092 return size;
00093 }
00094
00095 void CL_OutputSource_Memory::open()
00096 {
00097 }
00098
00099 void CL_OutputSource_Memory::close()
00100 {
00101 }
00102
00103 CL_OutputSource *CL_OutputSource_Memory::clone()
00104 {
00105 cl_assert(false);
00106 return NULL;
00107 }
00108
00109 int CL_OutputSource_Memory::tell()
00110 {
00111 return m_pos;
00112 }
00113
00114 int CL_OutputSource_Memory::size()
00115 {
00116 return m_pos;
00117 }
00118
00119 void CL_OutputSource_Memory::write_string(const char *string)
00120 {
00121 int len = strlen(string)+1;
00122 write_int32(len);
00123 write((char*) string, len);
00124 }