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

#ifndef UHDM_CLOCKING_BLOCK_H
#define UHDM_CLOCKING_BLOCK_H

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

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




namespace UHDM {
class clocking_block;
class delay_control;
class event_control;
class instance;
class virtual_interface_var;

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

  int32_t VpiInputEdge() const { return vpiInputEdge_; }
  bool VpiInputEdge(int32_t data) {
    vpiInputEdge_ = data;
    return true;
  }

  int32_t VpiOutputEdge() const { return vpiOutputEdge_; }
  bool VpiOutputEdge(int32_t data) {
    vpiOutputEdge_ = data;
    return true;
  }

  delay_control* Input_skew()  { return input_skew_; }
  const delay_control* Input_skew() const { return input_skew_; }
  template <typename T>
  T* Input_skew() {
    return (input_skew_ == nullptr) ? nullptr : any_cast<T*>(input_skew_);
  }
  template <typename T>
  const T* Input_skew() const {
    return (input_skew_ == nullptr) ? nullptr : any_cast<const T*>(input_skew_);
  }
  bool Input_skew(delay_control* data) {
    input_skew_ = data;
    return true;
  }

  delay_control* Output_skew()  { return output_skew_; }
  const delay_control* Output_skew() const { return output_skew_; }
  template <typename T>
  T* Output_skew() {
    return (output_skew_ == nullptr) ? nullptr : any_cast<T*>(output_skew_);
  }
  template <typename T>
  const T* Output_skew() const {
    return (output_skew_ == nullptr) ? nullptr : any_cast<const T*>(output_skew_);
  }
  bool Output_skew(delay_control* data) {
    output_skew_ = data;
    return true;
  }

  event_control* Clocking_event()  { return clocking_event_; }
  const event_control* Clocking_event() const { return clocking_event_; }
  template <typename T>
  T* Clocking_event() {
    return (clocking_event_ == nullptr) ? nullptr : any_cast<T*>(clocking_event_);
  }
  template <typename T>
  const T* Clocking_event() const {
    return (clocking_event_ == nullptr) ? nullptr : any_cast<const T*>(clocking_event_);
  }
  bool Clocking_event(event_control* data) {
    clocking_event_ = data;
    return true;
  }

  instance* Instance()  { return instance_; }
  const instance* Instance() const { return instance_; }
  template <typename T>
  T* Instance() {
    return (instance_ == nullptr) ? nullptr : any_cast<T*>(instance_);
  }
  template <typename T>
  const T* Instance() const {
    return (instance_ == nullptr) ? nullptr : any_cast<const T*>(instance_);
  }
  bool Instance(instance* data) {
    instance_ = data;
    return true;
  }

  VectorOfclocking_io_decl* Clocking_io_decls() const { return clocking_io_decls_; }
  bool Clocking_io_decls(VectorOfclocking_io_decl* data) {
    clocking_io_decls_ = data;
    return true;
  }

  virtual_interface_var* Prefix()  { return prefix_; }
  const virtual_interface_var* Prefix() const { return prefix_; }
  template <typename T>
  T* Prefix() {
    return (prefix_ == nullptr) ? nullptr : any_cast<T*>(prefix_);
  }
  template <typename T>
  const T* Prefix() const {
    return (prefix_ == nullptr) ? nullptr : any_cast<const T*>(prefix_);
  }
  bool Prefix(virtual_interface_var* data) {
    prefix_ = data;
    return true;
  }

  clocking_block* Actual()  { return actual_; }
  const clocking_block* Actual() const { return actual_; }
  template <typename T>
  T* Actual() {
    return (actual_ == nullptr) ? nullptr : any_cast<T*>(actual_);
  }
  template <typename T>
  const T* Actual() const {
    return (actual_ == nullptr) ? nullptr : any_cast<const T*>(actual_);
  }
  bool Actual(clocking_block* data) {
    actual_ = data;
    return true;
  }

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

  virtual clocking_block* 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::uhdmclocking_block; }

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

private:
  int32_t vpiInputEdge_ = 0;

  int32_t vpiOutputEdge_ = 0;

  delay_control* input_skew_ = nullptr;

  delay_control* output_skew_ = nullptr;

  event_control* clocking_event_ = nullptr;

  instance* instance_ = nullptr;

  VectorOfclocking_io_decl* clocking_io_decls_ = nullptr;

  virtual_interface_var* prefix_ = nullptr;

  clocking_block* actual_ = nullptr;
};


typedef FactoryT<clocking_block> clocking_blockFactory;


typedef FactoryT<std::vector<clocking_block *>> VectorOfclocking_blockFactory;

}  // namespace UHDM

#endif
