User-defined origin type. More...
#include <origin.hpp>
Public Member Functions | |
| origin (const mgdType &newType) | |
| origin (const mgdType &newType, node *subpod) | |
| origin (const me &rhs) | |
| me & | operator= (const me &rhs) |
| scope & | subs () override |
| state | getState () const override |
| void | setState (state new1) override |
| const ntype & | getType () const override |
| const node & | getSubPod () const override |
| Retrieves a sub-pod represented as a node. | |
| const src & | getSrc () const override |
| void | onCloneDeep (const clonable &from) override |
| baseObj * | make () const override |
| node * | getCallComplete () override |
| Returns the node responsible for completing the object's construction or initialization calls. | |
| void | setCallComplete (const node &new1) |
| void | setCallComplete (const node *it) BY_SIDE_FUNC(setCallComplete) |
| nbool | isComplete () const override |
| clonable * | clone () const override |
| clonable * | cloneDeep () const override |
Public Member Functions inherited from by::obj | |
| obj () | |
| Constructs an obj representing an "any" class. | |
| obj (const scope &subs) | |
| Constructs an obj from a given scope, typically representing its initial set of children. | |
| obj (const me &rhs) | |
| Copy constructor for obj. | |
| me & | operator= (const me &rhs) |
| tstr< nbicontainer > | mySubs () const override |
| scope & | getShares () |
| const scope &getShares() const BY_CONST_FUNC(getShares()) scope const scope::super & | getOwns () const BY_CONST_FUNC(getOwns()) const ntype &getType() const override |
| void | onCloneDeep (const clonable &from) override |
| Performs a deep clone operation, copying the contents from another clonable object. | |
| const node *getCallComplete() const BY_CONST_FUNC(getCallComplete()) protected str | _onBeforeCtor () override |
| Hook method called before the object's constructor is fully executed. | |
Public Member Functions inherited from by::baseObj | |
| str | eval (const args &a) override |
| priorType | prioritize (const args &a) const override |
| virtual const baseObj & | getOrigin () const |
| void | inFrame (const bicontainable *args) const override |
| void | outFrame () const override |
| const modifier & | getModifier () const override |
Public Member Functions inherited from by::node | |
| me & | operator[] (const std::string &name) |
| const me & | operator[] (const std::string &name) const BY_CONST_FUNC(operator[](name)) |
| me & | operator[] (const std::string *it) |
| const me & | operator[] (const std::string *it) const BY_CONST_FUNC(operator[](it)) |
| me & | operator[] (const nchar *name) |
| const me & | operator[] (const nchar *name) const BY_CONST_FUNC(operator[](name)) |
| nbool | in (const node &elem) const |
| nbool | in (const node *elem) const |
| const scope & | subs () const BY_CONST_FUNC(subs()) virtual tstr< nbicontainer > mySubs() const |
| Returns a tstr to a container of immediate sub-nodes (excluding inherited or chained ones). | |
| const node * | promote (const node &it) const |
| const node * | promote (const node *it) const BY_SIDE_FUNC(promote) |
| template<typename T > | |
| T * | sub (std::function< nbool(const std::string &, const T &)> l) |
| template<typename T > | |
| const T * | sub (std::function< nbool(const std::string &, const T &)> l) const BY_CONST_FUNC(sub< T >(l)) template< typename T |
| template<typename T = me> | |
| const T * | sub () const BY_CONST_FUNC(sub< T >()) template< typename T |
| template<typename T = me> | |
| T * | sub (const std::string *it) BY_SIDE_FUNC(sub) |
| template<typename T = me> | |
| const T * | sub (const std::string &name) const BY_CONST_FUNC(sub< T >(name)) template< typename T |
| template<typename T = me> | |
| T * | sub (const std::string *name, const args &a) BY_SIDE_FUNC(name |
| template<typename T = me> | |
| const T * | sub (const std::string &name, const args &a) const BY_CONST_FUNC(sub< T >(name |
| template<typename T = me> | |
| const T a const T * | sub (const std::string *name, const args &a) const BY_CONST_FUNC(sub< T >(name |
| template<typename T > | |
| const T a const T a tnarr< T, strTactic > | subAll (std::function< nbool(const std::string &, const T &)> l) const |
| template<typename T = me> | |
| tnarr< T, strTactic > | subAll () const |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string &name) const |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string *it) const BY_SIDE_FUNC(subAll< T >) template< typename T |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string &name, const args &a) const |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string *name, const args *a) const BY_SIDE_FUNC(name |
| tpriorities< T > subAll< T > | tpriorities ()) |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string *name, const args &a) const BY_SIDE_FUNC(name |
| tpriorities< T > subAll< T > | tpriorities ()) |
| bool | canEval (const args &a) const |
| priorType | prioritize (const args *it) const BY_SIDE_FUNC(it |
| str | eval (const args *it) BY_SIDE_FUNC(eval) |
| str | eval (const std::string &name, const args &a) |
| str | eval (const std::string &name, const args *a) BY_SIDE_FUNC(a |
| str | eval (name, a) |
| str | str ()) |
| str | eval (const std::string *name, const args &a) BY_SIDE_FUNC(name |
| str eval | str ()) |
| str | eval (const std::string *name, const args *a) BY_SIDE_FUNC(name &&a |
| str eval | str ()) |
| str | eval (const std::string &name) |
| str | eval (const std::string *it) BY_SIDE_FUNC(eval) |
| str | eval () |
| virtual void | rel () |
| template<typename T > | |
| nbool | is () const |
| nbool | is (const typeProvidable &to) const |
| nbool | is (const typeProvidable *it) const BY_SIDE_FUNC(is) |
| nbool | is (const type &to) const |
| nbool | is (const type *it) const BY_SIDE_FUNC(is) |
| template<typename T > | |
| tstr< T > | as () const |
| str | as (const typeProvidable &to) const |
| str | as (const typeProvidable *it) const BY_SIDE_FUNC(as) |
| str | as (const type &to) const |
| str | as (const type *it) const BY_SIDE_FUNC(as) |
| template<typename T > | |
| nbool | isImpli () const |
| virtual nbool | isImpli (const type &to) const |
| nbool | isImpli (const typeProvidable &to) const |
| nbool | isImpli (const typeProvidable *it) const BY_SIDE_FUNC(isImpli) |
| template<typename T > | |
| tstr< T > | asImpli () const |
| virtual str | asImpli (const type &to) const |
| str | asImpli (const typeProvidable &to) const |
| str | asImpli (const typeProvidable *it) const BY_SIDE_FUNC(asImpli) |
| virtual str | infer () const |
| virtual void | accept (const visitInfo &i, visitor &v) |
| void | inFrame (const bicontainable *args) const override |
| void | outFrame () const override |
| virtual void | inFrame (const bicontainable *args) const=0 |
| void | inFrame () const |
| virtual void | outFrame () const=0 |
Public Member Functions inherited from by::frameInteractable | |
| void | inFrame () const |
Additional Inherited Members | |
Public Attributes inherited from by::node | |
| T sub | name |
| T sub | nullptr |
| tpriorities< T > subAll< T > | name |
| priorType prioritize | it |
| priorType prioritize | NO_MATCH |
| str eval | name |
Static Public Attributes inherited from by::baseObj | |
| static const std::string | COMMON_NAME = "@common" |
| static const std::string | EXPAND_NAME = "@expand" |
Protected Member Functions inherited from by::obj | |
| obj (const scope &shares, scope &owns) | |
| Protected constructor for obj, allowing explicit separation of shares and owns. | |
Protected Member Functions inherited from by::baseObj | |
| baseObj ()=default | |
| Default constructor for baseObj. | |
| baseObj (const baseObj *org, nbool isScripted) | |
| Constructs a baseObj from an existing origin object. | |
| str | _onEvalSub (node &sub, const args &a) override |
| Protected virtual method for evaluating a sub-node. | |
| virtual void | _inFrame (frame &fr, const bicontainable *args) const |
| Enters this object's frame into the current execution stack. | |
Protected Member Functions inherited from by::node | |
| void | _setSrc (const src *it) BY_SIDE_FUNC(_setSrc) |
Protected Attributes inherited from by::baseObj | |
| tstr< baseObj > | _org |
User-defined origin type.
The original type defined by users in the byeol language is called an origin object. Constructor calls like ctor all create by copy-constructing origin objects.
getType() doesn't just apply to script object origin types defined in byeol. It also provides types for native environment C++ classes like node and instance. For example, suppose a user writes this byeol code:
MyObj is part of the AST, so in C++ it's represented as an instance of obj. If you call getType() on the obj instance representing MyObj without additional code, what happens? Naturally ttype<obj>() is returned. The problem is calling on the obj instance representing YourObj also returns the same ttype<obj>(). Result: starter executing the program thinks YourObj and MyObj are the same type.
To solve this, the C++ obj class has a mgdType variable as a member. mgdType is type information for byeol types in the byeol runtime environment. See mgdType for details. The key point is this mgdType is structured to extend the existing native type meta information tree, so it's represented as inheriting from ttype<obj>. Thus, calling getType() on the C++ MyObj object yields mgdType, and this type can be distinguished from YourObj while having parent class obj type.
If we didn't do this but instead separated getType() and getMgdType(), all functions using type would need to distinguish whether the received node* is a native or script object, and if managed, call getMgdType() to handle it.
Sharp readers may now understand why cast<origin>() shouldn't be used. Without any processing, origin class's getType() would try to return ttype<origin>(). But as in the example above, the obj instance created to represent byeol code's MyObj must return mgdType. And naturally ttype<origin> has no inheritance relationship with the just-created mgdType instance, so calling cast<origin> fails the internal type check.
Therefore, the key is that starting from C++'s obj class, providing metatype by existing C++ class switches to providing metatype by C++ instance via mgdType. So don't carelessly try to use the meta module on origin objects. origin class's getType() returns a type with no relation to C++'s origin type. But this mgdType is created by the parser to have ttype<obj> as parent class. So type conversion to obj type or cast<obj>() etc. are no problem.
|
overridevirtual |
Returns the node responsible for completing the object's construction or initialization calls.
In the Byeol language, object construction might involve specific nodes that handle the final steps or logic after the object is initially created.
Reimplemented from by::obj.
Reimplemented from by::baseObj.
|
overridevirtual |
Reimplemented from by::obj.
Retrieves a sub-pod represented as a node.
This method is used to access nested pod structures or components within this base object.
Reimplemented from by::baseObj.
|
overridevirtual |
returns whether this instance is complete or not. if some instance is incomplete, it means that it's not accessible on byeolang source codes.
Reimplemented from by::node.
|
overridevirtual |
Reimplemented from by::baseObj.
|
overridevirtual |
Reimplemented from by::obj.