Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.56/34: Рейтинг темы: голосов - 34, средняя оценка - 4.56
0 / 0 / 0
Регистрация: 09.03.2017
Сообщений: 7
1

Error C2259: cannot instantiate abstract class

09.03.2017, 14:15. Показов 6914. Ответов 8
Метки c++ (Все метки)

Author24 — интернет-сервис помощи студентам
Всем добрый день.
Создаю класс-наследник, переопределяю все виртуальные функции, но все равно ошибка "error C2259: cannot instantiate abstract class"
Мои предположения:
1. Мне из всех функций родителя нужна парочка, поэтому остальные переопределяю абы-как. Может быть здесь собака порылась?
2. Родительский класс сам по себе тоже наследник абстрактного класса, и в родителе функции родителя родителя почему-то не переопределены, тем не менее другие классы наследники родителя работают абсолютно нормально. в общем,буду благодарен, если объясните что к чему.
Код ниже, реализации наверное вставлять не буду, а то и так громоздко выходит, для примера постну одну свою:
Мой класс:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
class PathValueNode : public TypedNode<ValueExprNode, ExprNode::TYPE_PATH>
{
public:
    explicit PathValueNode(MemoryPool& pool);
 
    static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
    virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
    virtual Firebird::string internalPrint(NodePrinter& printer) const;
    virtual bool dsqlMatch(const ExprNode* other, bool ignoreMapCast) const;
    virtual bool setParameterType(DsqlCompilerScratch* dsqlScratch,
        const dsc* desc, bool forceVarChar)
    {
        return false;
    }
 
    virtual void setParameterName(dsql_par* parameter) const;
    virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc);
 
    virtual ValueExprNode* dsqlFieldRemapper(FieldRemapper& visitor)
    {
        ExprNode::dsqlFieldRemapper(visitor);
        return this;
    }
 
    virtual ValueExprNode* pass1(thread_db* tdbb, CompilerScratch* csb)
    {
        ExprNode::pass1(tdbb, csb);
        return this;
    }
 
    virtual ValueExprNode* pass2(thread_db* tdbb, CompilerScratch* csb)
    {
        ExprNode::pass2(tdbb, csb);
        return this;
    }
 
    virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc);
    virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const;
    virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
 
public:
    Firebird::Array<NestConst<PathNode>> path;
}; 
 
Реализация метода для примера:
 
DmlNode* PathValueNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
    return NULL;
}
 
Родительский класс:
class ValueExprNode : public ExprNode
{
public:
    ValueExprNode(Type aType, MemoryPool& pool)
        : ExprNode(aType, pool, KIND_VALUE),
          nodScale(0)
    {
        nodDesc.clear();
    }
 
public:
    virtual Firebird::string internalPrint(NodePrinter& printer) const = 0;
 
    virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
    {
        ExprNode::dsqlPass(dsqlScratch);
        return this;
    }
 
    virtual bool setParameterType(DsqlCompilerScratch* /*dsqlScratch*/,
        const dsc* /*desc*/, bool /*forceVarChar*/)
    {
        return false;
    }
 
    virtual void setParameterName(dsql_par* parameter) const = 0;
    virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc) = 0;
 
    virtual ValueExprNode* dsqlFieldRemapper(FieldRemapper& visitor)
    {
        ExprNode::dsqlFieldRemapper(visitor);
        return this;
    }
 
    virtual ValueExprNode* pass1(thread_db* tdbb, CompilerScratch* csb)
    {
        ExprNode::pass1(tdbb, csb);
        return this;
    }
 
    virtual ValueExprNode* pass2(thread_db* tdbb, CompilerScratch* csb)
    {
        ExprNode::pass2(tdbb, csb);
        return this;
    }
 
    // Compute descriptor for value expression.
    virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc) = 0;
 
    virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const = 0;
    virtual dsc* execute(thread_db* tdbb, jrd_req* request) const = 0;
 
public:
    SCHAR nodScale;
    dsc nodDesc;
};
 
Родитель родителя:
class ExprNode : public DmlNode
{
public:
    enum Type
    {
        // Value types
        TYPE_AGGREGATE,
        TYPE_ALIAS,
        TYPE_ARITHMETIC,
        TYPE_ARRAY,
        TYPE_BOOL_AS_VALUE,
        TYPE_CAST,
        TYPE_COALESCE,
        TYPE_COLLATE,
        TYPE_CONCATENATE,
        TYPE_CURRENT_DATE,
        TYPE_CURRENT_TIME,
        TYPE_CURRENT_TIMESTAMP,
        TYPE_CURRENT_ROLE,
        TYPE_CURRENT_USER,
        TYPE_DERIVED_EXPR,
        TYPE_DECODE,
        TYPE_DERIVED_FIELD,
        TYPE_DOMAIN_VALIDATION,
        TYPE_EXTRACT,
        TYPE_FIELD,
        TYPE_GEN_ID,
        TYPE_INTERNAL_INFO,
        TYPE_LITERAL,
        TYPE_MAP,
        TYPE_NEGATE,
        TYPE_NULL,
        TYPE_ORDER,
        TYPE_OVER,
        TYPE_PARAMETER,
        TYPE_RECORD_KEY,
        TYPE_SCALAR,
        TYPE_STMT_EXPR,
        TYPE_STR_CASE,
        TYPE_STR_LEN,
        TYPE_SUBQUERY,
        TYPE_SUBSTRING,
        TYPE_SUBSTRING_SIMILAR,
        TYPE_SYSFUNC_CALL,
        TYPE_TRIM,
        TYPE_UDF_CALL,
        TYPE_VALUE_IF,
        TYPE_VARIABLE,
 
        // Bool types
        TYPE_BINARY_BOOL,
        TYPE_COMPARATIVE_BOOL,
        TYPE_MISSING_BOOL,
        TYPE_NOT_BOOL,
        TYPE_RSE_BOOL,
 
        // RecordSource types
        TYPE_AGGREGATE_SOURCE,
        TYPE_PROCEDURE,
        TYPE_RELATION,
        TYPE_RSE,
        TYPE_SELECT_EXPR,
        TYPE_UNION,
        TYPE_WINDOW,
 
        // List types
        TYPE_REC_SOURCE_LIST,
        TYPE_VALUE_LIST
#ifdef _RxO
        , TYPE_CLASS,
        TYPE_PATH
#endif
    };
 
    // Generic flags.
    static const unsigned FLAG_INVARIANT    = 0x01; // Node is recognized as being invariant.
 
    // Boolean flags.
    static const unsigned FLAG_DEOPTIMIZE   = 0x02; // Boolean which requires deoptimization.
    static const unsigned FLAG_RESIDUAL     = 0x04; // Boolean which must remain residual.
    static const unsigned FLAG_ANSI_NOT     = 0x08; // ANY/ALL predicate is prefixed with a NOT one.
 
    // Value flags.
    static const unsigned FLAG_DOUBLE       = 0x10;
    static const unsigned FLAG_DATE         = 0x20;
    static const unsigned FLAG_VALUE        = 0x40; // Full value area required in impure space.
 
    explicit ExprNode(Type aType, MemoryPool& pool, Kind aKind)
        : DmlNode(pool, aKind),
          type(aType),
          nodFlags(0),
          impureOffset(0),
          dsqlCompatDialectVerb(NULL),
          dsqlChildNodes(pool),
          jrdChildNodes(pool)
    {
    }
 
    template <typename T> T* as()
    {
        const ExprNode* const thisPointer = this;   // avoid warning
        return thisPointer && type == T::TYPE ? static_cast<T*>(this) : NULL;
    }
 
    template <typename T> const T* as() const
    {
        const ExprNode* const thisPointer = this;   // avoid warning
        return thisPointer && type == T::TYPE ? static_cast<const T*>(this) : NULL;
    }
 
    template <typename T> bool is() const
    {
        const ExprNode* const thisPointer = this;   // avoid warning
        return thisPointer && type == T::TYPE;
    }
 
    template <typename T, typename LegacyType> static T* as(LegacyType* node)
    {
        return node ? node->template as<T>() : NULL;
    }
 
    template <typename T, typename LegacyType> static const T* as(const LegacyType* node)
    {
        return node ? node->template as<T>() : NULL;
    }
 
    template <typename T, typename LegacyType> static bool is(const LegacyType* node)
    {
        return node ? node->template is<T>() : false;
    }
 
    // Allocate and assign impure space for various nodes.
    template <typename T> static void doPass2(thread_db* tdbb, CompilerScratch* csb, T** node)
    {
        if (!*node)
            return;
 
        *node = (*node)->pass2(tdbb, csb);
    }
 
    virtual Firebird::string internalPrint(NodePrinter& printer) const = 0;
 
    virtual bool dsqlAggregateFinder(AggregateFinder& visitor)
    {
        bool ret = false;
 
        for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
            ret |= visitor.visit((*i)->getExpr());
 
        return ret;
    }
 
    virtual bool dsqlAggregate2Finder(Aggregate2Finder& visitor)
    {
        bool ret = false;
 
        for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
            ret |= visitor.visit((*i)->getExpr());
 
        return ret;
    }
 
    virtual bool dsqlFieldFinder(FieldFinder& visitor)
    {
        bool ret = false;
 
        for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
            ret |= visitor.visit((*i)->getExpr());
 
        return ret;
    }
 
    virtual bool dsqlInvalidReferenceFinder(InvalidReferenceFinder& visitor)
    {
        bool ret = false;
 
        for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
            ret |= visitor.visit((*i)->getExpr());
 
        return ret;
    }
 
    virtual bool dsqlSubSelectFinder(SubSelectFinder& visitor)
    {
        bool ret = false;
 
        for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
            ret |= visitor.visit((*i)->getExpr());
 
        return ret;
    }
 
    virtual ExprNode* dsqlFieldRemapper(FieldRemapper& visitor)
    {
        for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
            (*i)->remap(visitor);
 
        return this;
    }
 
    template <typename T>
    static void doDsqlFieldRemapper(FieldRemapper& visitor, NestConst<T>& node)
    {
        if (node)
            node = node->dsqlFieldRemapper(visitor);
    }
 
    template <typename T1, typename T2>
    static void doDsqlFieldRemapper(FieldRemapper& visitor, NestConst<T1>& target, NestConst<T2> node)
    {
        target = node ? node->dsqlFieldRemapper(visitor) : NULL;
    }
 
    // Check if expression could return NULL or expression can turn NULL into a true/false.
    virtual bool possiblyUnknown()
    {
        for (NodeRef** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i)
        {
            if (**i && (*i)->getExpr()->possiblyUnknown())
                return true;
        }
 
        return false;
    }
 
    // Verify if this node is allowed in an unmapped boolean.
    virtual bool unmappable(const MapNode* mapNode, StreamType shellStream)
    {
        for (NodeRef** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i)
        {
            if (**i && !(*i)->getExpr()->unmappable(mapNode, shellStream))
                return false;
        }
 
        return true;
    }
 
    // Return all streams referenced by the expression.
    virtual void collectStreams(SortedStreamList& streamList) const
    {
        for (const NodeRef* const* i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i)
        {
            if (**i)
                (*i)->getExpr()->collectStreams(streamList);
        }
    }
 
    virtual bool findStream(StreamType stream)
    {
        SortedStreamList streams;
        collectStreams(streams);
 
        return streams.exist(stream);
    }
 
    virtual bool dsqlMatch(const ExprNode* other, bool ignoreMapCast) const;
 
    virtual ExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
    {
        DmlNode::dsqlPass(dsqlScratch);
        return this;
    }
 
    // Determine if two expression trees are the same.
    virtual bool sameAs(const ExprNode* other, bool ignoreStreams) const;
 
    // See if node is presently computable.
    // A node is said to be computable, if all the streams involved
    // in that node are csb_active. The csb_active flag defines
    // all the streams available in the current scope of the query.
    virtual bool computable(CompilerScratch* csb, StreamType stream,
        bool allowOnlyCurrentStream, ValueExprNode* value = NULL);
 
    virtual void findDependentFromStreams(const OptimizerRetrieval* optRet,
        SortedStreamList* streamList);
    virtual ExprNode* pass1(thread_db* tdbb, CompilerScratch* csb);
    virtual ExprNode* pass2(thread_db* tdbb, CompilerScratch* csb);
    virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const = 0;
 
protected:
    template <typename T1, typename T2>
    void addChildNode(NestConst<T1>& dsqlNode, NestConst<T2>& jrdNode)
    {
        addDsqlChildNode(dsqlNode);
        addChildNode(jrdNode);
    }
 
    template <typename T>
    void addDsqlChildNode(NestConst<T>& dsqlNode)
    {
        dsqlChildNodes.add(FB_NEW_POOL(getPool()) NodeRefImpl<T>(dsqlNode.getAddress()));
    }
 
    template <typename T>
    void addChildNode(NestConst<T>& jrdNode)
    {
        jrdChildNodes.add(FB_NEW_POOL(getPool()) NodeRefImpl<T>(jrdNode.getAddress()));
    }
 
public:
    const Type type;
    unsigned nodFlags;
    ULONG impureOffset;
    const char* dsqlCompatDialectVerb;
    Firebird::Array<NodeRef*> dsqlChildNodes;
    Firebird::Array<NodeRef*> jrdChildNodes;
};
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
09.03.2017, 14:15
Ответы с готовыми решениями:

error: allocating an object of abstract class type 'Tetragon'
Добрый день Нужна помощь. При компиляции программы у меня выводить ошибку error: allocating an...

Fatal error: Class user contains 1 abstract method and must therefore be declared abstract or implement the remaining
abstract class AUser{ abstract function showInfo(); } class user extends AUser { public...

Class is not abstract and doesn't override abstract method destroyApp(boolean)
Занялся програмированием,взял самый простой код &quot;hello.World!&quot;,но в нём было много ошибок,я их...

Class must either be declared abstract or implement abstract method
Есть такая ошибка Class 'MainActivity' must either be declared abstract or implement abstract...

8
nmcf
09.03.2017, 15:13
  #2

Не по теме:

Теги поставь.

0
0 / 0 / 0
Регистрация: 09.03.2017
Сообщений: 7
09.03.2017, 17:46  [ТС] 3
Тогда наводящий вопрос: Могут ли быть в функции не использованы аргументы?

Например:

C++
1
2
3
4
DmlNode* PathValueNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
return NULL;
}
не выдаст так ошибку?

в общем не знаю как избавиться от , на самом деле это : и p
0
7793 / 6560 / 2984
Регистрация: 14.04.2014
Сообщений: 28,672
09.03.2017, 17:54 4

Не по теме:

Теги CPP, говорю, поставь на текст программы - никто не станет читать это в таком виде.



Добавлено через 31 секунду
Цитата Сообщение от mumr Посмотреть сообщение
Могут ли быть в функции не использованы аргументы?
Да.
1
0 / 0 / 0
Регистрация: 09.03.2017
Сообщений: 7
09.03.2017, 18:08  [ТС] 5
с этим вроде разобрался, в отрыве от всего - работает. тогда с остальным вообще темный лес

Добавлено через 5 минут
Цитата Сообщение от nmcf Посмотреть сообщение
Теги CPP, говорю, поставь на текст программы - никто не станет читать это в таком виде.
ага, понятно. думал теги темы. поставлю, как сделать, где почитать?
0
nmcf
09.03.2017, 18:09
  #6

Не по теме:

Просто выделяешь и жмёшь на панели инструментов C++.

0
0 / 0 / 0
Регистрация: 09.03.2017
Сообщений: 7
09.03.2017, 18:13  [ТС] 7
Спасибо, тогда вот оно!

Мой класс:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class PathValueNode : public TypedNode<ValueExprNode, ExprNode::TYPE_PATH>
{
public:
explicit PathValueNode(MemoryPool& pool);
 
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
virtual Firebird::string internalPrint(NodePrinter& printer) const;
virtual bool dsqlMatch(const ExprNode* other, bool ignoreMapCast) const;
virtual bool setParameterType(DsqlCompilerScratch* dsqlScratch,
const dsc* desc, bool forceVarChar)
{
return false;
}
 
virtual void setParameterName(dsql_par* parameter) const;
virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc);
 
virtual ValueExprNode* dsqlFieldRemapper(FieldRemapper& visitor)
{
ExprNode::dsqlFieldRemapper(visitor);
return this;
}
 
virtual ValueExprNode* pass1(thread_db* tdbb, CompilerScratch* csb)
{
ExprNode:ass1(tdbb, csb);
return this;
}
 
virtual ValueExprNode* pass2(thread_db* tdbb, CompilerScratch* csb)
{
ExprNode:ass2(tdbb, csb);
return this;
}
 
virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc);
virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const;
 
public:
Firebird::Array<NestConst<PathNode>> path;
};
Реализация метода для примера:
C++
1
2
3
4
DmlNode* PathValueNode:arse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
{
return NULL;
}
Родительский класс:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class ValueExprNode : public ExprNode
{
public:
ValueExprNode(Type aType, MemoryPool& pool)
: ExprNode(aType, pool, KIND_VALUE),
nodScale(0)
{
nodDesc.clear();
}
 
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const = 0;
 
virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
{
ExprNode::dsqlPass(dsqlScratch);
return this;
}
 
virtual bool setParameterType(DsqlCompilerScratch* /*dsqlScratch*/,
const dsc* /*desc*/, bool /*forceVarChar*/)
{
return false;
}
 
virtual void setParameterName(dsql_par* parameter) const = 0;
virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc) = 0;
 
virtual ValueExprNode* dsqlFieldRemapper(FieldRemapper& visitor)
{
ExprNode::dsqlFieldRemapper(visitor);
return this;
}
 
virtual ValueExprNode* pass1(thread_db* tdbb, CompilerScratch* csb)
{
ExprNode:ass1(tdbb, csb);
return this;
}
 
virtual ValueExprNode* pass2(thread_db* tdbb, CompilerScratch* csb)
{
ExprNode:ass2(tdbb, csb);
return this;
}
 
// Compute descriptor for value expression.
virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc) = 0;
 
virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const = 0;
virtual dsc* execute(thread_db* tdbb, jrd_req* request) const = 0;
 
public:
SCHAR nodScale;
dsc nodDesc;
};
Родитель родителя:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
class ExprNode : public DmlNode
{
public:
enum Type
{
// Value types
TYPE_AGGREGATE,
TYPE_ALIAS,
TYPE_ARITHMETIC,
TYPE_ARRAY,
TYPE_BOOL_AS_VALUE,
TYPE_CAST,
TYPE_COALESCE,
TYPE_COLLATE,
TYPE_CONCATENATE,
TYPE_CURRENT_DATE,
TYPE_CURRENT_TIME,
TYPE_CURRENT_TIMESTAMP,
TYPE_CURRENT_ROLE,
TYPE_CURRENT_USER,
TYPE_DERIVED_EXPR,
TYPE_DECODE,
TYPE_DERIVED_FIELD,
TYPE_DOMAIN_VALIDATION,
TYPE_EXTRACT,
TYPE_FIELD,
TYPE_GEN_ID,
TYPE_INTERNAL_INFO,
TYPE_LITERAL,
TYPE_MAP,
TYPE_NEGATE,
TYPE_NULL,
TYPE_ORDER,
TYPE_OVER,
TYPE_PARAMETER,
TYPE_RECORD_KEY,
TYPE_SCALAR,
TYPE_STMT_EXPR,
TYPE_STR_CASE,
TYPE_STR_LEN,
TYPE_SUBQUERY,
TYPE_SUBSTRING,
TYPE_SUBSTRING_SIMILAR,
TYPE_SYSFUNC_CALL,
TYPE_TRIM,
TYPE_UDF_CALL,
TYPE_VALUE_IF,
TYPE_VARIABLE,
 
// Bool types
TYPE_BINARY_BOOL,
TYPE_COMPARATIVE_BOOL,
TYPE_MISSING_BOOL,
TYPE_NOT_BOOL,
TYPE_RSE_BOOL,
 
// RecordSource types
TYPE_AGGREGATE_SOURCE,
TYPE_PROCEDURE,
TYPE_RELATION,
TYPE_RSE,
TYPE_SELECT_EXPR,
TYPE_UNION,
TYPE_WINDOW,
 
// List types
TYPE_REC_SOURCE_LIST,
TYPE_VALUE_LIST
#ifdef _RxO
, TYPE_CLASS,
TYPE_PATH
#endif
};
 
// Generic flags.
static const unsigned FLAG_INVARIANT    = 0x01; // Node is recognized as being invariant.
 
// Boolean flags.
static const unsigned FLAG_DEOPTIMIZE   = 0x02; // Boolean which requires deoptimization.
static const unsigned FLAG_RESIDUAL = 0x04; // Boolean which must remain residual.
static const unsigned FLAG_ANSI_NOT = 0x08; // ANY/ALL predicate is prefixed with a NOT one.
 
// Value flags.
static const unsigned FLAG_DOUBLE   = 0x10;
static const unsigned FLAG_DATE = 0x20;
static const unsigned FLAG_VALUE    = 0x40; // Full value area required in impure space.
 
explicit ExprNode(Type aType, MemoryPool& pool, Kind aKind)
: DmlNode(pool, aKind),
type(aType),
nodFlags(0),
impureOffset(0),
dsqlCompatDialectVerb(NULL),
dsqlChildNodes(pool),
jrdChildNodes(pool)
{
}
 
template <typename T> T* as()
{
const ExprNode* const thisPointer = this;   // avoid warning
return thisPointer && type == T::TYPE ? static_cast<T*>(this) : NULL;
}
 
template <typename T> const T* as() const
{
const ExprNode* const thisPointer = this;   // avoid warning
return thisPointer && type == T::TYPE ? static_cast<const T*>(this) : NULL;
}
 
template <typename T> bool is() const
{
const ExprNode* const thisPointer = this;   // avoid warning
return thisPointer && type == T::TYPE;
}
 
template <typename T, typename LegacyType> static T* as(LegacyType* node)
{
return node ? node->template as<T>() : NULL;
}
 
template <typename T, typename LegacyType> static const T* as(const LegacyType* node)
{
return node ? node->template as<T>() : NULL;
}
 
template <typename T, typename LegacyType> static bool is(const LegacyType* node)
{
return node ? node->template is<T>() : false;
}
 
// Allocate and assign impure space for various nodes.
template <typename T> static void doPass2(thread_db* tdbb, CompilerScratch* csb, T** node)
{
if (!*node)
return;
 
*node = (*node)->pass2(tdbb, csb);
}
 
virtual Firebird::string internalPrint(NodePrinter& printer) const = 0;
 
virtual bool dsqlAggregateFinder(AggregateFinder& visitor)
{
bool ret = false;
 
for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
ret |= visitor.visit((*i)->getExpr());
 
return ret;
}
 
virtual bool dsqlAggregate2Finder(Aggregate2Finder& visitor)
{
bool ret = false;
 
for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
ret |= visitor.visit((*i)->getExpr());
 
return ret;
}
 
virtual bool dsqlFieldFinder(FieldFinder& visitor)
{
bool ret = false;
 
for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
ret |= visitor.visit((*i)->getExpr());
 
return ret;
}
 
virtual bool dsqlInvalidReferenceFinder(InvalidReferenceFinder& visitor)
{
bool ret = false;
 
for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
ret |= visitor.visit((*i)->getExpr());
 
return ret;
}
 
virtual bool dsqlSubSelectFinder(SubSelectFinder& visitor)
{
bool ret = false;
 
for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
ret |= visitor.visit((*i)->getExpr());
 
return ret;
}
 
virtual ExprNode* dsqlFieldRemapper(FieldRemapper& visitor)
{
for (NodeRef* const* i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i)
(*i)->remap(visitor);
 
return this;
}
 
template <typename T>
static void doDsqlFieldRemapper(FieldRemapper& visitor, NestConst<T>& node)
{
if (node)
node = node->dsqlFieldRemapper(visitor);
}
 
template <typename T1, typename T2>
static void doDsqlFieldRemapper(FieldRemapper& visitor, NestConst<T1>& target, NestConst<T2> node)
{
target = node ? node->dsqlFieldRemapper(visitor) : NULL;
}
 
// Check if expression could return NULL or expression can turn NULL into a true/false.
virtual bool possiblyUnknown()
{
for (NodeRef** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i)
{
if (**i && (*i)->getExpr()->possiblyUnknown())
return true;
}
 
return false;
}
 
// Verify if this node is allowed in an unmapped boolean.
virtual bool unmappable(const MapNode* mapNode, StreamType shellStream)
{
for (NodeRef** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i)
{
if (**i && !(*i)->getExpr()->unmappable(mapNode, shellStream))
return false;
}
 
return true;
}
 
// Return all streams referenced by the expression.
virtual void collectStreams(SortedStreamList& streamList) const
{
for (const NodeRef* const* i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i)
{
if (**i)
(*i)->getExpr()->collectStreams(streamList);
}
}
 
virtual bool findStream(StreamType stream)
{
SortedStreamList streams;
collectStreams(streams);
 
return streams.exist(stream);
}
 
virtual bool dsqlMatch(const ExprNode* other, bool ignoreMapCast) const;
 
virtual ExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
{
DmlNode::dsqlPass(dsqlScratch);
return this;
}
 
// Determine if two expression trees are the same.
virtual bool sameAs(const ExprNode* other, bool ignoreStreams) const;
 
// See if node is presently computable.
// A node is said to be computable, if all the streams involved
// in that node are csb_active. The csb_active flag defines
// all the streams available in the current scope of the query.
virtual bool computable(CompilerScratch* csb, StreamType stream,
bool allowOnlyCurrentStream, ValueExprNode* value = NULL);
 
virtual void findDependentFromStreams(const OptimizerRetrieval* optRet,
SortedStreamList* streamList);
virtual ExprNode* pass1(thread_db* tdbb, CompilerScratch* csb);
virtual ExprNode* pass2(thread_db* tdbb, CompilerScratch* csb);
virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const = 0;
 
protected:
template <typename T1, typename T2>
void addChildNode(NestConst<T1>& dsqlNode, NestConst<T2>& jrdNode)
{
addDsqlChildNode(dsqlNode);
addChildNode(jrdNode);
}
 
template <typename T>
void addDsqlChildNode(NestConst<T>& dsqlNode)
{
dsqlChildNodes.add(FB_NEW_POOL(getPool()) NodeRefImpl<T>(dsqlNode.getAddress()));
}
 
template <typename T>
void addChildNode(NestConst<T>& jrdNode)
{
jrdChildNodes.add(FB_NEW_POOL(getPool()) NodeRefImpl<T>(jrdNode.getAddress()));
}
 
public:
const Type type;
unsigned nodFlags;
ULONG impureOffset;
const char* dsqlCompatDialectVerb;
Firebird::Array<NodeRef*> dsqlChildNodes;
Firebird::Array<NodeRef*> jrdChildNodes;
};
0
7793 / 6560 / 2984
Регистрация: 14.04.2014
Сообщений: 28,672
09.03.2017, 18:56 8
А что такое TypedNode? Ты наследуешь свой класс не от ValueExprNode, а от какого-то шаблона?
1
0 / 0 / 0
Регистрация: 09.03.2017
Сообщений: 7
09.03.2017, 20:42  [ТС] 9
ну собственно да, как я понимаю этот шаблон как раз и делает PathValueNode наследником ValueExprNode

вот он:

C++
1
2
3
4
5
6
7
8
9
10
11
12
template <typename T, typename T::Type typeConst>
class TypedNode : public T
{
public:
    explicit TypedNode(MemoryPool& pool)
        : T(typeConst, pool)
    {
    }
 
public:
    const static typename T::Type TYPE = typeConst;
};
0
09.03.2017, 20:42
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
09.03.2017, 20:42
Помогаю со студенческими работами здесь

Error: Failed to instantiate component or class "user"
итак у меня была задача--- блокировать новых юзеров через каждых 3 дня после регистрации если они...

При компиляции ошибка Cant instantiate class
Добрый день. Пытаюсь загрузить сл. страницу xhtml &lt;?xml version='1.0' encoding='UTF-8' ?&gt;...

Предупреждение: class is not abstract
Здравствуйте! Подскажите, пожалуйста, почему выдаёт предупреждение &quot;...class is not abstract and...

error C2259: last: невозможно создать экземпляр абстрактного класса
Только начала изучать абстрактные классы, и сразу же проблемы. error C2259: last: невозможно...

Abstract class & STL
list&lt;CGraphicsObject*&gt; objS; objS.push_back(new Circle(&quot;Circle&quot; , 1)); objS.push_back(new...

error C2259: number_of_plants: невозможно создать экземпляр абстрактного класса
error C2259: number_of_plants: невозможно создать экземпляр абстрактного класса Пожалуйста,...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
9
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru