| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- // package elem_base -- базовый объект
- package elem_base
- import (
- "gitp78su.ipnodns.ru/svi/goarch/lev0/alias"
- "gitp78su.ipnodns.ru/svi/goarch/lev1/coord"
- "gitp78su.ipnodns.ru/svi/goarch/lev1/label"
- "gitp78su.ipnodns.ru/svi/goarch/lev1/offset"
- "gitp78su.ipnodns.ru/svi/kern/v3"
- )
- // ElemBase -- базовый объект
- type ElemBase struct {
- Label_ *label.Label `yaml:"label"` // название объекта
- Id_ alias.Id `yaml:"id"` // Идентификатор объекта
- Type_ alias.Type `yaml:"type"` // Тип объекта
- Elem_ map[string]interface{} `yaml:"map_elem"` // Набор полей
- StrElem_ string // Строковое представление объекта
- }
- var (
- hassert = kern.GetFnHassert()
- )
- // NewElemBase -- возвращает новый базовый объект
- func NewElemBase(id alias.Id, label_ alias.Label, labelCoord *coord.Coord,
- labelOffset *offset.Offset, type_ alias.Type,
- elem map[string]interface{}, binElem []byte) *ElemBase {
- hassert(id != "", "NewElemBase(): id is empty")
- hassert(type_ != "", "NewElemBase(): type is empty")
- sf := &ElemBase{
- Elem_: elem,
- StrElem_: string(binElem),
- Label_: label.NewLabel(label_, labelCoord, labelOffset),
- Id_: id,
- Type_: type_,
- }
- return sf
- }
- // Elem -- возвращает элементы словаря
- func (sf *ElemBase) Elem() map[string]interface{} {
- return sf.Elem_
- }
- // Type -- возвращает тип объекта
- func (sf *ElemBase) Type() alias.Type {
- return sf.Type_
- }
- // Id -- возвращает ID объекта
- func (sf *ElemBase) Id() alias.Id {
- return sf.Id_
- }
|