Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
InputOutputStream.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
5
6namespace Stroika::Foundation::Streams::InputOutputStream {
7
8 /*
9 ********************************************************************************
10 ***************** InputOutputStream::Ptr<ELEMENT_TYPE> *************************
11 ********************************************************************************
12 */
13 template <typename ELEMENT_TYPE>
14 inline Ptr<ELEMENT_TYPE>::Ptr (const shared_ptr<IRep<ELEMENT_TYPE>>& rep)
15 : InputStream::Ptr<ELEMENT_TYPE>{rep}
16 , OutputStream::Ptr<ELEMENT_TYPE>{rep}
17 {
18 RequireNotNull (rep);
19 }
20 template <typename ELEMENT_TYPE>
21 inline Ptr<ELEMENT_TYPE>::Ptr (nullptr_t)
22 : InputStream::Ptr<ELEMENT_TYPE>{nullptr}
23 , OutputStream::Ptr<ELEMENT_TYPE>{nullptr}
24 {
25 }
26 template <typename ELEMENT_TYPE>
27 inline auto Ptr<ELEMENT_TYPE>::GetSharedRep () const -> shared_ptr<IRep<ELEMENT_TYPE>>
28 {
29 Ensure (dynamic_pointer_cast<IRep<ELEMENT_TYPE>> (InputStream::Ptr<ELEMENT_TYPE>::_GetSharedRep ()) ==
30 dynamic_pointer_cast<IRep<ELEMENT_TYPE>> (OutputStream::Ptr<ELEMENT_TYPE>::GetSharedRep ()));
31 return Debug::UncheckedDynamicPointerCast<IRep<ELEMENT_TYPE>> (InputStream::Ptr<ELEMENT_TYPE>::GetSharedRep ());
32 }
33 template <typename ELEMENT_TYPE>
34 inline auto Ptr<ELEMENT_TYPE>::GetRepConstRef () const -> const IRep<ELEMENT_TYPE>&
35 {
36 Ensure (dynamic_cast<const IRep<ELEMENT_TYPE>*> (&InputStream::Ptr<ELEMENT_TYPE>::GetRepConstRef ()) ==
37 dynamic_cast<const IRep<ELEMENT_TYPE>*> (&OutputStream::Ptr<ELEMENT_TYPE>::GetRepConstRef ()));
38 return *Debug::UncheckedDynamicCast<const IRep<ELEMENT_TYPE>*> (&InputStream::Ptr<ELEMENT_TYPE>::GetRepConstRef ());
39 }
40 template <typename ELEMENT_TYPE>
41 inline auto Ptr<ELEMENT_TYPE>::GetRepRWRef () const -> IRep<ELEMENT_TYPE>&
42 {
44 return *Debug::UncheckedDynamicCast<IRep<ELEMENT_TYPE>*> (&InputStream::Ptr<ELEMENT_TYPE>::GetRepRWRef ());
45 }
46 template <typename ELEMENT_TYPE>
52 template <typename ELEMENT_TYPE>
53 inline void Ptr<ELEMENT_TYPE>::Close () const
54 {
55 CloseRead ();
56 CloseWrite ();
57 }
58 template <typename ELEMENT_TYPE>
59 inline void Ptr<ELEMENT_TYPE>::Close (bool reset)
60 {
61 CloseRead (reset);
62 CloseWrite (reset);
63 }
64 template <typename ELEMENT_TYPE>
69 template <typename ELEMENT_TYPE>
70 inline void Ptr<ELEMENT_TYPE>::CloseRead (bool reset)
71 {
73 }
74 template <typename ELEMENT_TYPE>
79 template <typename ELEMENT_TYPE>
80 inline void Ptr<ELEMENT_TYPE>::CloseWrite (bool reset)
81 {
83 }
84 template <typename ELEMENT_TYPE>
85 inline bool Ptr<ELEMENT_TYPE>::IsOpenRead () const
86 {
88 }
89 template <typename ELEMENT_TYPE>
90 inline bool Ptr<ELEMENT_TYPE>::IsOpenWrite () const
91 {
93 }
94 template <typename ELEMENT_TYPE>
96 {
98 }
99 template <typename ELEMENT_TYPE>
101 {
103 }
104 template <typename ELEMENT_TYPE>
105 inline SeekOffsetType Ptr<ELEMENT_TYPE>::SeekWrite (SignedSeekOffsetType offset) const
106 {
107 return OutputStream::Ptr<ELEMENT_TYPE>::Seek (offset);
108 }
109 template <typename ELEMENT_TYPE>
110 inline SeekOffsetType Ptr<ELEMENT_TYPE>::SeekWrite (Whence whence, SignedSeekOffsetType offset) const
111 {
112 return OutputStream::Ptr<ELEMENT_TYPE>::Seek (whence, offset);
113 }
114 template <typename ELEMENT_TYPE>
115 inline SeekOffsetType Ptr<ELEMENT_TYPE>::SeekRead (SignedSeekOffsetType offset) const
116 {
117 return InputStream::Ptr<ELEMENT_TYPE>::Seek (offset);
118 }
119 template <typename ELEMENT_TYPE>
120 inline SeekOffsetType Ptr<ELEMENT_TYPE>::SeekRead (Whence whence, SignedSeekOffsetType offset) const
121 {
122 return InputStream::Ptr<ELEMENT_TYPE>::Seek (whence, offset);
123 }
124 template <typename ELEMENT_TYPE>
125 inline bool Ptr<ELEMENT_TYPE>::operator== (nullptr_t) const
126 {
129 }
130
131}
#define RequireNotNull(p)
Definition Assertions.h:347
InputOutputStream is single stream object that acts much as a InputStream::Ptr and an OutputStream::P...
InputStream<>::Ptr is Smart pointer (with abstract Rep) class defining the interface to reading from ...
OutputStream<>::Ptr is Smart pointer to a stream-based sink of data.
A Streams::Ptr<ELEMENT_TYPE> is a smart-pointer to a stream of elements of type T.
Definition Stream.h:170