/*
 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:   prop_formal_decl.h
 * Author:
 *
 * Created on December 14, 2019, 10:03 PM
 */

#ifndef UHDM_PROP_FORMAL_DECL_H
#define UHDM_PROP_FORMAL_DECL_H

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

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

#include "property_expr_named_event_group.h"


namespace UHDM {
class ref_typespec;

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

  virtual bool VpiName(std::string_view data) final;
  virtual std::string_view VpiName() const final;

  int32_t VpiDirection() const { return vpiDirection_; }
  bool VpiDirection(int32_t data) {
    vpiDirection_ = data;
    return true;
  }

  any* VpiExpr()  { return vpiExpr_; }
  const any* VpiExpr() const { return vpiExpr_; }
  template <typename T>
  T* VpiExpr() {
    return (vpiExpr_ == nullptr) ? nullptr : any_cast<T*>(vpiExpr_);
  }
  template <typename T>
  const T* VpiExpr() const {
    return (vpiExpr_ == nullptr) ? nullptr : any_cast<const T*>(vpiExpr_);
  }
  bool VpiExpr(any* data) {
    if (!property_expr_named_event_groupGroupCompliant(data)) return false;
    vpiExpr_ = data;
    return true;
  }

  ref_typespec* Typespec()  { return typespec_; }
  const ref_typespec* Typespec() const { return typespec_; }
  template <typename T>
  T* Typespec() {
    return (typespec_ == nullptr) ? nullptr : any_cast<T*>(typespec_);
  }
  template <typename T>
  const T* Typespec() const {
    return (typespec_ == nullptr) ? nullptr : any_cast<const T*>(typespec_);
  }
  bool Typespec(ref_typespec* data) {
    typespec_ = data;
    return true;
  }

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

  virtual prop_formal_decl* 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::uhdmprop_formal_decl; }

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

private:
  SymbolId vpiName_;

  int32_t vpiDirection_ = 0;

  any* vpiExpr_ = nullptr;

  ref_typespec* typespec_ = nullptr;
};


typedef FactoryT<prop_formal_decl> prop_formal_declFactory;


typedef FactoryT<std::vector<prop_formal_decl *>> VectorOfprop_formal_declFactory;

}  // namespace UHDM

#endif
