MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / CopyBufferAPI

Class CopyBufferAPI

src/python/PyImath/PyImathBufferProtocol.cpp:122–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120//
121template <class ArrayT>
122class CopyBufferAPI : public BufferAPI<ArrayT>
123{
124 public:
125
126 using BufferAPI<ArrayT>::atomicSize;
127
128 explicit
129 CopyBufferAPI (ArrayT &a)
130 : BufferAPI<ArrayT> (a.len(), a.stride()),
131 _copy (a)
132 {}
133
134 virtual ~CopyBufferAPI() = default;
135
136 // NonCopyable
137 CopyBufferAPI (const CopyBufferAPI &rhs) = delete;
138 CopyBufferAPI &operator= (const CopyBufferAPI &rhs) = delete;
139
140 bool sharedBuffer() const override
141 { return false; }
142
143 Py_ssize_t numBytes() const override
144 { return _copy.len() * atomicSize() * _copy.stride(); }
145
146 bool readOnly() const override
147 { return false; }
148
149 void *buffer() override
150 { return static_cast<void *> (&_copy.direct_index(0)); }
151
152 private:
153
154 ArrayT _copy;
155};
156
157
158template <class ArrayT>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected