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

#ifndef UHDM_GEN_FOR_H
#define UHDM_GEN_FOR_H

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

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

#include "stmt.h"


namespace UHDM {
class expr;

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

  uint32_t VpiType() const final { return vpiFor; }

  int32_t VpiLocalVarDecls() const { return vpiLocalVarDecls_; }
  bool VpiLocalVarDecls(int32_t data) {
    vpiLocalVarDecls_ = data;
    return true;
  }

  VectorOfany* VpiForInitStmts() const { return vpiForInitStmts_; }
  bool VpiForInitStmts(VectorOfany* data) {
    if (!stmtGroupCompliant(data)) return false;
    vpiForInitStmts_ = data;
    return true;
  }

  VectorOfany* VpiForIncStmts() const { return vpiForIncStmts_; }
  bool VpiForIncStmts(VectorOfany* data) {
    if (!stmtGroupCompliant(data)) return false;
    vpiForIncStmts_ = data;
    return true;
  }

  any* VpiForInitStmt()  { return vpiForInitStmt_; }
  const any* VpiForInitStmt() const { return vpiForInitStmt_; }
  template <typename T>
  T* VpiForInitStmt() {
    return (vpiForInitStmt_ == nullptr) ? nullptr : any_cast<T*>(vpiForInitStmt_);
  }
  template <typename T>
  const T* VpiForInitStmt() const {
    return (vpiForInitStmt_ == nullptr) ? nullptr : any_cast<const T*>(vpiForInitStmt_);
  }
  bool VpiForInitStmt(any* data) {
    if (!stmtGroupCompliant(data)) return false;
    vpiForInitStmt_ = 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;
  }

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

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

  virtual gen_for* 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::uhdmgen_for; }

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

private:
  int32_t vpiLocalVarDecls_ = 0;

  VectorOfany* vpiForInitStmts_ = nullptr;

  VectorOfany* vpiForIncStmts_ = nullptr;

  any* vpiForInitStmt_ = nullptr;

  expr* vpiCondition_ = nullptr;

  any* vpiForIncStmt_ = nullptr;

  any* vpiStmt_ = nullptr;
};


typedef FactoryT<gen_for> gen_forFactory;


typedef FactoryT<std::vector<gen_for *>> VectorOfgen_forFactory;

}  // namespace UHDM

#endif
