//#####################################################################
// Copyright 2022, Craig Schroeder.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class SYMBOLIC_NUMBER
//##################################################################### 
#ifndef __SYMBOLIC_NUMBER__
#define __SYMBOLIC_NUMBER__

#include <Core/Symbolics/SYMBOLIC.h>
#include <string>
namespace PhysBAM{

struct SYMBOLIC_NUMBER:public SYMBOLIC_BASE
{
    std::string s;

    SYMBOLIC_NUMBER();
    SYMBOLIC_NUMBER(const SYMBOLIC_NUMBER& t)=default;
    
    ~SYMBOLIC_NUMBER()=default;
    void Cache();
    void Set(double x) override;
    void Print(double x,std::ostream& o) const override;

    SYMBOLIC_BASE* Clone() const override;
    void Unary(double x,const SYMBOLIC& a,type_1 op) override;
    void Binary(double x,const SYMBOLIC& a,const SYMBOLIC& b,type_2 op) override;
};

inline void Set_Name(double& s,const std::string& n){}
inline void Set_Name(float& s,const std::string& n){}
inline void Set_Name(SYMBOLIC& s,const std::string& n)
{
    if(auto p=dynamic_cast<SYMBOLIC_NUMBER*>(s.z)) p->s=n;
}

inline std::string Name(const double& s){return "";}
inline std::string Name(const float& s){return "";}
inline std::string Name(const SYMBOLIC& s)
{
    if(auto p=dynamic_cast<const SYMBOLIC_NUMBER*>(s.z)) return p->s;
    return "";
}
}

#endif
