MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / NodeCopier

Class NodeCopier

src/dsql/Visitors.h:195–263  ·  view source on GitHub ↗

Generic node copier.

Source from the content-addressed store, hash-verified

193
194// Generic node copier.
195class NodeCopier : public Firebird::PermanentStorage
196{
197public:
198 NodeCopier(Firebird::MemoryPool& pool, CompilerScratch* aCsb, StreamType* aRemap)
199 : PermanentStorage(pool),
200 csb(aCsb),
201 remap(aRemap),
202 message(NULL)
203 {
204 }
205
206 virtual ~NodeCopier()
207 {
208 }
209
210public:
211 // Copy an expression tree remapping field streams. If the map isn't present, don't remap.
212 template <typename T>
213 T* copy(thread_db* tdbb, const T* input)
214 {
215 if (!input)
216 return NULL;
217
218 T* copy = input->copy(tdbb, *this);
219 postCopy(input, copy, copy);
220
221 return copy;
222 }
223
224 template <typename T>
225 T* copy(thread_db* tdbb, const NestConst<T>& input)
226 {
227 return copy(tdbb, input.getObject());
228 }
229
230 template <typename T>
231 static T* copy(thread_db* tdbb, CompilerScratch* csb, const T* input, StreamType* remap)
232 {
233 return NodeCopier(*tdbb->getDefaultPool(), csb, remap).copy(tdbb, input);
234 }
235
236 template <typename T>
237 static T* copy(thread_db* tdbb, CompilerScratch* csb, const NestConst<T>& input, StreamType* remap)
238 {
239 return NodeCopier(*tdbb->getDefaultPool(), csb, remap).copy(tdbb, input.getObject());
240 }
241
242 virtual USHORT remapField(USHORT /*stream*/, USHORT fldId)
243 {
244 return fldId;
245 }
246
247 virtual USHORT getFieldId(const FieldNode* input);
248
249private:
250 template <typename T1, typename T2> void postCopy(const T1* source, T2* target, ExprNode* /*dummy*/)
251 {
252 target->nodFlags = source->nodFlags;

Callers 2

copyMethod · 0.85
createFromFieldMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected