4 using System::IO::File;
5 using namespace System::IO::FileStream_ns;
6 using System::RunTime::Array;
7 using System::RunTime::MutableArray;
11 using System::Notifiers::Notifier;
18 #include "server/c++/Stuff/FileStream.h"
19 //#include "sample-cpp-server-decl.h"
29 printf("this is %p\n", this);
30 IO::FileStream fs = *this;
31 IO::IOStream ostr = fs;
32 IO::FileStream fs2 = IO::FileStream::downcast(ostr);
33 printf("classptr is %p/%p\n", classptr(fs), classptr(fs2));
36 printf("File is NULL\n");
38 printf("File is not NULL\n");
43 void get_file(File *F)
48 void seek(int64_t offset, SeekType type)
51 // FIXME: Add a constructor to structs
52 System::Exceptions::Std::InvalidState err;
57 case SeekType::FromBeginning:
61 case SeekType::FromCurrent:
65 case SeekType::FromEnd:
72 void get_pos(uint64_t *POS)
77 void size(uint64_t *size)
82 void read(Array<uint8_t> *buf, uint64_t *len)
89 f.read(pos, buf, len);
93 void read_foo(MutableArray<uint8_t> buf, uint64_t len, Notifier n)
100 f.read_async(pos, buf, len, n);
104 void write(Array<uint8_t> buf, uint64_t *len)
111 f.write(pos, buf, len);
115 void write_foo(Array<uint8_t> buf, uint64_t len, Notifier n)
117 printf("write_foo, this %p\n", this);
124 f.write_async(pos, buf, len, n);
128 void new_timer(::System::Time::Timer *timer)
134 //#include "sample-cpp-server-footer.cc"
135 #include "server/c++/footer.cc"
138 const unsigned long System::IO::_i_IOStream::guid[4] = { 1 };
139 const unsigned long System::IO::_i_IStream::guid[4] = { 2 };
140 const unsigned long System::IO::_i_OStream::guid[4] = { 3 };
141 const unsigned long System::IO::_i_FileStream::guid[4] = { 4 };
142 const unsigned long System::_i_Object::guid[4] = { 5 };
147 Stuff::FileStream *fsimp = new Stuff::FileStream();
148 System::IO::FileStream fs = *fsimp;
151 printf("fs is NULL\n");
153 printf("fs is not NULL\n");
157 printf("fs is %p\n", (void *)fs);
158 fs.write_async(Array<uint8_t>(NULL, 0), 0, NULL);
159 printf("fs is %p\n", (void *)fs);
160 System::IO::OStream ostr = fs;
161 printf("ostr is %p\n", (void *)ostr);
162 ostr.write_async(Array<uint8_t>(NULL, 0), 0, NULL);
163 System::Object obj = fs;
164 System::IO::FileStream fs2 = System::IO::FileStream::downcast(obj);
165 System::IO::OStream os2 = System::IO::OStream::downcast(obj);
166 printf("obj %p fs2 %p os2 %p\n", (void *)obj, (void *)fs2, (void *)os2);