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

#ifndef UHDM_CASE_STMT_H
#define UHDM_CASE_STMT_H

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

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




namespace UHDM {
class expr;

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

  uint32_t VpiType() const final { return vpiCase; }

  uint32_t VpiRandType() const { return vpiRandType_; }
  bool VpiRandType(uint32_t data) {
    vpiRandType_ = data;
    return true;
  }

  int32_t VpiCaseType() const { return vpiCaseType_; }
  bool VpiCaseType(int32_t data) {
    vpiCaseType_ = data;
    return true;
  }

  int32_t VpiQualifier() const { return vpiQualifier_; }
  bool VpiQualifier(int32_t data) {
    vpiQualifier_ = data;
    return true;
  }

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

  VectorOfcase_item* Case_items() const { return case_items_; }
  bool Case_items(VectorOfcase_item* data) {
    case_items_ = data;
    return true;
  }

  virtual case_stmt* 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::uhdmcase_stmt; }

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

private:
  uint32_t vpiRandType_ = 0;

  int32_t vpiCaseType_ = 0;

  int32_t vpiQualifier_ = 0;

  expr* vpiCondition_ = nullptr;

  VectorOfcase_item* case_items_ = nullptr;
};


typedef FactoryT<case_stmt> case_stmtFactory;


typedef FactoryT<std::vector<case_stmt *>> VectorOfcase_stmtFactory;

}  // namespace UHDM

#endif
