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

#ifndef UHDM_PART_SELECT_H
#define UHDM_PART_SELECT_H

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

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




namespace UHDM {
class expr;

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

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

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

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

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

  virtual part_select* 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::uhdmpart_select; }

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

private:
  bool vpiConstantSelect_ = false;

  expr* left_range_ = nullptr;

  expr* right_range_ = nullptr;
};


typedef FactoryT<part_select> part_selectFactory;


typedef FactoryT<std::vector<part_select *>> VectorOfpart_selectFactory;

}  // namespace UHDM

#endif
