/
ischema.h
81 lines (59 loc) · 2.75 KB
/
ischema.h
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
//
// Copyright (c) 2017-2023, Manticore Software LTD (https://manticoresearch.com)
// Copyright (c) 2001-2016, Andrew Aksyonoff
// Copyright (c) 2008-2016, Sphinx Technologies Inc
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License. You should have
// received a copy of the GPL license along with this program; if you
// did not, you can find it at http://www.gnu.org/
//
#pragma once
#include "columninfo.h"
class CSphRsetSchema;
/// barebones schema interface
/// everything that is needed from every implementation of a schema
class ISphSchema
{
public:
/// dtor
virtual ~ISphSchema () = default;
/// assign current schema to rset schema (kind of a visitor operator)
virtual void AssignTo ( class CSphRsetSchema & lhs ) const = 0;
/// get schema name
virtual const char * GetName() const = 0;
/// add an attribute
virtual void AddAttr ( const CSphColumnInfo & tAttr, bool bDynamic ) = 0;
/// get row size (static+dynamic combined)
virtual int GetRowSize() const = 0;
/// get static row part size
virtual int GetStaticSize() const = 0;
/// get dynamic row part size
virtual int GetDynamicSize() const = 0;
virtual int GetAttrsCount() const = 0;
virtual int GetFieldsCount() const = 0;
virtual const CSphColumnInfo & GetField ( int iIndex ) const = 0;
virtual const CSphColumnInfo * GetField ( const char * szName ) const = 0;
virtual const CSphVector<CSphColumnInfo> & GetFields () const = 0;
/// get attribute index by name, returns -1 if not found
virtual int GetAttrIndex ( const char * sName ) const = 0;
/// get field index by name, returns -1 if not found
virtual int GetFieldIndex ( const char * sName ) const = 0;
/// get attr by index
virtual const CSphColumnInfo & GetAttr ( int iIndex ) const = 0;
/// get attr by name
virtual const CSphColumnInfo * GetAttr ( const char * sName ) const = 0;
/// get the first one of field length attributes. return -1 if none exist
virtual int GetAttrId_FirstFieldLen() const = 0;
/// get the last one of field length attributes. return -1 if none exist
virtual int GetAttrId_LastFieldLen() const = 0;
/// free all allocated attibures. Does NOT free m_pDynamic of match itself!
virtual void FreeDataPtrs ( CSphMatch & tMatch ) const = 0;
/// return original attribute id (for compound schemas)
virtual int GetAttrIndexOriginal ( const char * szName ) const = 0;
/// simple copy; clones either the entire dynamic part, or a part thereof
virtual void CloneMatch ( CSphMatch & tDst, const CSphMatch & rhs ) const = 0;
virtual void SwapAttrs ( CSphVector<CSphColumnInfo> & dAttrs ) = 0;
virtual ISphSchema* CloneMe() const = 0;
};