mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
convert VectorVal's to use vector<ZVal> as internal representation
This commit is contained in:
parent
6121e409d3
commit
0299ea0894
3 changed files with 138 additions and 26 deletions
26
src/Val.h
26
src/Val.h
|
@ -1305,7 +1305,7 @@ public:
|
|||
* @return The element at the given index or nullptr if the index
|
||||
* does not exist (it's greater than or equal to vector's current size).
|
||||
*/
|
||||
const ValPtr& At(unsigned int index) const;
|
||||
ValPtr At(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* Returns the given element treated as a Count type, to efficiently
|
||||
|
@ -1364,7 +1364,29 @@ protected:
|
|||
ValPtr DoClone(CloneState* state) override;
|
||||
|
||||
private:
|
||||
std::vector<ValPtr>* vector_val;
|
||||
// Check the type of the given element against our current
|
||||
// yield type and adjust as necessary. Returns whether the
|
||||
// element type-checked.
|
||||
bool CheckElementType(const ValPtr& element);
|
||||
|
||||
std::vector<ZVal>* vector_val;
|
||||
|
||||
// For homogeneous vectors (the usual case), the type of the
|
||||
// elements. Will be TYPE_VOID for empty vectors created using
|
||||
// "vector()".
|
||||
TypePtr yield_type;
|
||||
|
||||
// True if this is a vector-of-any, or potentially one (which is
|
||||
// the case for empty vectors created using "vector()").
|
||||
bool any_yield;
|
||||
|
||||
// For heterogeneous vectors, the individual type of each element,
|
||||
// parallel to vector_val. Heterogeneous vectors can arise for
|
||||
// "vector of any" when disparate elements are stored in the vector.
|
||||
//
|
||||
// Thus, if yield_types is non-nil, then we know this is a
|
||||
// vector-of-any.
|
||||
std::vector<TypePtr>* yield_types = nullptr;
|
||||
};
|
||||
|
||||
#define UNDERLYING_ACCESSOR_DEF(ztype, ctype, name) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue