/*
 Do not modify, auto-generated by classes.py

 Copyright 2019 Alain Dargelas

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

/*
 * File:   struct_var.h
 * Author:
 *
 * Created on December 14, 2019, 10:03 PM
 */

#ifndef UHDM_STRUCT_VAR_H
#define UHDM_STRUCT_VAR_H

#include <uhdm/sv_vpi_user.h>
#include <uhdm/uhdm_vpi_user.h>

#include <uhdm/containers.h>
#include <uhdm/variables.h>




namespace UHDM {
class expr;

class struct_var final : public variables {
  UHDM_IMPLEMENT_RTTI(struct_var, variables)
public:
  // Implicit constructor used to initialize all members,
  // comment: struct_var();
  virtual ~struct_var() final = default;

  bool VpiPackedArrayMember() const { return vpiPackedArrayMember_; }
  bool VpiPackedArrayMember(bool data) {
    vpiPackedArrayMember_ = data;
    return true;
  }

  bool VpiConstantSelect() const { return vpiConstantSelect_; }
  bool VpiConstantSelect(bool data) {
    vpiConstantSelect_ = data;
    return true;
  }

  VectorOfvar_bit* Var_bits() const { return var_bits_; }
  bool Var_bits(VectorOfvar_bit* data) {
    var_bits_ = data;
    return true;
  }

  VectorOfvariables* Variables() const { return variables_; }
  bool Variables(VectorOfvariables* data) {
    variables_ = data;
    return true;
  }

  expr* Expr_index()  { return expr_index_; }
  const expr* Expr_index() const { return expr_index_; }
  template <typename T>
  T* Expr_index() {
    return (expr_index_ == nullptr) ? nullptr : any_cast<T*>(expr_index_);
  }
  template <typename T>
  const T* Expr_index() const {
    return (expr_index_ == nullptr) ? nullptr : any_cast<const T*>(expr_index_);
  }
  bool Expr_index(expr* data) {
    expr_index_ = data;
    return true;
  }

  virtual uint32_t VpiType() const final { return vpiStructVar; }

  virtual struct_var* DeepClone(BaseClass* parent, CloneContext* context) const override;

  virtual const BaseClass* GetByVpiName(std::string_view name) const override;

  virtual std::tuple<const BaseClass*, UHDM_OBJECT_TYPE, const std::vector<const BaseClass*>*> GetByVpiType(int32_t type) const override;

  virtual vpi_property_value_t GetVpiPropertyValue(int32_t property) const override;

  virtual int32_t Compare(const BaseClass* other, CompareContext* context) const override;

  virtual  UHDM_OBJECT_TYPE UhdmType() const final { return UHDM_OBJECT_TYPE::uhdmstruct_var; }

protected:
  void DeepCopy(struct_var* clone, BaseClass* parent, CloneContext* context) const;

private:
  bool vpiPackedArrayMember_ = false;

  bool vpiConstantSelect_ = false;

  VectorOfvar_bit* var_bits_ = nullptr;

  VectorOfvariables* variables_ = nullptr;

  expr* expr_index_ = nullptr;
};


typedef FactoryT<struct_var> struct_varFactory;


typedef FactoryT<std::vector<struct_var *>> VectorOfstruct_varFactory;

}  // namespace UHDM

#endif
