dynamic::var_impl Class Reference
[Types]

This is the interface which all objects implement. More...

#include <var_impl.hpp>

Inheritance diagram for dynamic::var_impl:

dynamic::internal::variant_base dynamic::inline_var_impl< T > dynamic::shared_var_impl dynamic::types::bool_impl< b > dynamic::types::double_impl dynamic::types::generic_function_impl< Derived, CmpIndex > dynamic::types::int_impl< Ch > dynamic::types::null_impl dynamic::types::proxy_impl dynamic::types::shared_var_proxy< Pointer > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_0 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_1 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_10 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_2 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_3 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_4 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_5 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_6 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_7 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_8 > dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_9 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v0 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v1 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v10 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v2 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v3 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v4 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v5 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v6 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v7 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v8 > dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v9 >

List of all members.

Public Member Functions

virtual var call ()
 Call the object with no arguments.
virtual var call (const var &a0)
 Call the object with 1 argument.
virtual var call (const var &a0, const var &a1)
 Call the object with 2 arguments.
virtual var call (const var &a0, const var &a1, const var &a2)
 Call the object with 3 arguments.
virtual var call (const var &a0, const var &a1, const var &a2, const var &a3)
 Call the object with 4 arguments.
virtual var call (const var &a0, const var &a1, const var &a2, const var &a3, const var &a4)
 Call the object with 5 arguments.
virtual var call (const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5)
 Call the object with 6 arguments.
virtual var call (const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5, const var &a6)
 Call the object with 7 arguments.
virtual var call (const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5, const var &a6, const var &a7)
 Call the object with 8 arguments.
virtual var call (const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5, const var &a6, const var &a7, const var &a8)
 Call the object with 9 arguments.
virtual var call (const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5, const var &a6, const var &a7, const var &a8, const var &a9)
 Call the object with 10 arguments.
virtual int max_args ()
 Return the maximum number arguments that the object can be called with.
virtual var member_call (const char *)
 Calls the given method with no arguments.
virtual var member_call (const char *, const var &a0)
 Calls the given method with 1 arguments.
virtual var member_call (const char *, const var &a0, const var &a1)
 Calls the given method with 2 arguments.
virtual var member_call (const char *, const var &a0, const var &a1, const var &a2)
 Calls the given method with 3 arguments.
virtual var member_call (const char *, const var &a0, const var &a1, const var &a2, const var &a3)
 Calls the given method with 4 arguments.
virtual var member_call (const char *, const var &a0, const var &a1, const var &a2, const var &a3, const var &a4)
 Calls the given method with 5 arguments.
virtual var member_call (const char *, const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5)
 Calls the given method with 6 arguments.
virtual var member_call (const char *, const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5, const var &a6)
 Calls the given method with 7 arguments.
virtual var member_call (const char *, const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5, const var &a6, const var &a7)
 Calls the given method with 8 arguments.
virtual var member_call (const char *, const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5, const var &a6, const var &a7, const var &a8)
 Calls the given method with 9 arguments.
virtual var member_call (const char *, const var &a0, const var &a1, const var &a2, const var &a3, const var &a4, const var &a5, const var &a6, const var &a7, const var &a8, const var &a9)
 Calls the given method with 10 arguments.
virtual var_cmp_index comparison_index ()
 Returns the comparison index (type identified) of the var.
virtual var_cmp_result compare (const var &other)
 Compares this object with another.
virtual var_cmp_result compare2 (const var &other)
 Compares two objects of the same comparison_index().
virtual var get_member (var const &)
 Gets the given member.
virtual void set_member (var const &, var const &)
 Sets the given member.
virtual var get_member (const char *)
 Gets the given member (string index).
virtual var get_member (int)
 Gets the given member (integer index).
virtual void set_member (const char *, var const &)
 Sets the given member (string index).
virtual void set_member (int, var const &)
 Sets the given member (integer index).
virtual void push_back (var const &)
 Pushes the value onto the back.
virtual var pop_back ()
 Removes a value from the back and returns it.
virtual void push_front (var const &)
 Pushes the value onto the front.
virtual var pop_front ()
 Removes a value from the front and returns it.
virtual void insert (const var &)
 Inserts an item.
virtual void insert (const var &, const var &)
 Inserts a pair.
virtual var front ()
 Retrieve the first/front item.
virtual var back ()
 Get the last/back item.
virtual var begin ()
 Returns an iterator to the begin (default=null).
virtual var end ()
 Returns an iterator to the end (default=null).
virtual int size ()
 Returns the number of items in the data structure (default=0).
virtual bool empty ()
 Returns whether the container is empty (default=true).
virtual var rbegin ()
 Returns the reverse begin iterator.
virtual var rend ()
 Returns the reverse end iterator.
virtual void clear ()
 Erases all items (default=no effect).
virtual bool contains (const var &)
 Returns whether the object contains.
virtual void erase (const var &)
 Erases the specified item, but does not throw on error.
virtual void mixin (const var &)
 Adds the members of one object to another.
virtual int bind_args ()
 Returns the number of bound arguments.
virtual void output (ostream &)
 Outputs to a narrow stream.
virtual void output (wostream &)
 Outputs to a wide stream.
virtual void short_output (ostream &)
 Short output to a narrow stream.
virtual void short_output (wostream &)
 Short output to a wide stream.
virtual int as_int ()
 Converts to an integer (default=0).
virtual double as_double ()
 Converts to a double (default=0).
virtual bool as_bool ()
 Converts to a bool (default=false).
virtual void * as_ptr ()
 Converts to a pointer (default=0).
virtual var deref ()
 Dereferences if the object is an iterator.
virtual var key ()
 Obtains the key from an iterator.
virtual var value ()
 Obtains the value from an iterator.
virtual var clone ()
 Clones the object.
virtual void resize (std::size_t)
 Resizes the object (for array and string containers).
virtual var op_add (const var &)
 Addition operator.
virtual var keys ()
 Return a container of keys.
virtual var values ()
 Return a container of values.
virtual var op_neg ()
 Unary minus.
virtual var op_pos ()
 Unary add (default is to clone).
virtual var op_sub (const var &)
 Subtraction operator.
virtual var op_mul (const var &)
 Multiplication operator.
virtual var op_div (const var &)
 Division operator.
virtual var op_mod (const var &)
 Modulus operator.
virtual var op_lshift (const var &)
 Left-shift operator.
virtual var op_rshift (const var &)
 Right-shift operator.
virtual var op_and (const var &)
 Bitwisze and operator.
virtual var op_or (const var &)
 Bitwise or operator.
virtual var op_xor (const var &)
 Bitwise xor operator.
virtual var op_inv ()
 Bitwise inverse operator.
virtual void op_inc ()
 Increment operator.
virtual void op_dec ()
 Decrement operator.
virtual void assign_add (const var &)
 Add with assignment.
virtual void assign_sub (const var &)
 Subtract with assignment.
virtual void assign_mul (const var &)
 Multiplication with assignment.
virtual void assign_div (const var &)
 Division with assign.
virtual void assign_mod (const var &)
 Modulus with assign.
virtual void assign_lshift (const var &)
 Left shift with assign.
virtual void assign_rshift (const var &)
 Right shift with assign.
virtual void assign_and (const var &)
 Bitwise and with assign.
virtual void assign_or (const var &)
 Bitwise or with assign.
virtual void assign_xor (const var &)
 Bitwise xor with assign.
virtual var member_inc (const char *member)
 Increment a member.
virtual var member_dec (const char *member)
 Decrement a member.
virtual var member_inc (const char *member, int)
 Add an integer to a member.
virtual var member_dec (const char *member, int)
 Subtract an integer from a member.
virtual var member_add (const char *member, const var &)
 Add to a member.
virtual var member_sub (const char *member, const var &)
 Subtract from a member.
virtual std::string class_name ()=0
 Return the class name.
virtual void pickle (pickler &)
 Pickle the object.
virtual void unpickle (unpickler &)
 Unpickle the object.
virtual var as_root ()
 Convert the object to a root object.
virtual var as_nonroot ()
 Convert this object to a non-root object.
virtual void mark_reachable (gc::garbage_collector &)
 Call this to mark the object as reachable (so that the garbage collector does not destroy it).
virtual shared_var_implshared_var ()
 Retrieve the shared variable or null.
virtual var proxy ()
 Returns a proxy to this object.
virtual var enumerator ()
 Returns an enumerator for the contents (default null).
virtual var reverse_enumerator ()
 Returns a reverse enumerator for the contents (default null).
virtual void reserve (std::size_t)
 Reserves (default no effect).
virtual std::size_t capacity ()
 Returns the capacity of the container before needing to reallocate (default=0).
virtual void get_range (std::size_t container_size, std::pair< std::size_t, std::size_t > &out)
 Obtains the range represented by this object (default=0).


Detailed Description

This is the interface which all objects implement.

dynamic::var contains one of these, and all methods in var (and var_methods) call this object.

For most implementations of this interface, most of these methods don't do anything, or throw the dynamic::not_supported exception. That's the crux of dynamic typing - you only know what operations are supported at run-time.

Definition at line 31 of file var_impl.hpp.


Member Function Documentation

virtual var dynamic::var_impl::as_root (  )  [virtual]

Convert the object to a root object.

TODO: change this mechanism

Reimplemented in dynamic::types::bool_impl< b >, dynamic::types::int_impl< Ch >, dynamic::types::proxy_impl, and dynamic::types::shared_var_proxy< Pointer >.

Referenced by dynamic::internal::nonroot_var::get().

virtual var_cmp_result dynamic::var_impl::compare ( const var other  )  [virtual]

Compares this object with another.

vars are usually compared first on comparison_index, then calls compare2() for objects of the same type

Reimplemented in dynamic::types::iterator, dynamic::types::shared_var_proxy< Pointer >, and dynamic::internal::wrap_cpp_container< Impl >::wrap_iterator< Iterator >.

virtual var dynamic::var_impl::enumerator (  )  [virtual]

virtual var dynamic::var_impl::get_member ( int   )  [virtual]

virtual var dynamic::var_impl::get_member ( const char *   )  [virtual]

Gets the given member (string index).

The string index is separate for efficiency

Reimplemented in dynamic::types::reverse_impl, dynamic::types::object_impl, dynamic::types::proxy_impl, and dynamic::types::shared_var_proxy< Pointer >.

virtual void dynamic::var_impl::mark_reachable ( gc::garbage_collector  )  [virtual]

Call this to mark the object as reachable (so that the garbage collector does not destroy it).

Call this method from dynamic::gc::gc_object::mark_children() method

Reimplemented in dynamic::shared_var_impl, and dynamic::types::shared_var_proxy< Pointer >.

virtual int dynamic::var_impl::max_args (  )  [virtual]

virtual void dynamic::var_impl::pickle ( pickler  )  [virtual]

Pickle the object.

See also:
dynamic::pickle() function.

Reimplemented in dynamic::types::bool_impl< b >, dynamic::types::dispatcher_impl, dynamic::types::double_impl, dynamic::types::generic_function_impl< Derived, CmpIndex >, dynamic::types::bind_impl< Args >, dynamic::types::varargs_impl, dynamic::types::int_impl< Ch >, dynamic::types::reverse_impl, dynamic::types::filter_impl, dynamic::types::transform_impl, dynamic::types::tail_impl, dynamic::types::null_impl, dynamic::types::object_impl, dynamic::types::range_impl, dynamic::types::set_impl, dynamic::types::shared_var_proxy< Pointer >, dynamic::internal::wrap_assoc_container< Impl >, dynamic::internal::wrap_array_container< Impl >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_9 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_2 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v1 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v0 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_3 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_4 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_5 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_0 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v7 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_1 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v6 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_10 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v9 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v8 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v3 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v2 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v5 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_6 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v4 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_7 >, dynamic::types::generic_function_impl< function_impl< void(* >, cmp_function_v10 >, dynamic::types::generic_function_impl< function_impl< var(* >, cmp_function_8 >, and dynamic::internal::wrap_assoc_container< object_traits >.

Referenced by dynamic::pickler::write_object().

virtual void dynamic::var_impl::short_output ( ostream &   )  [virtual]

virtual int dynamic::var_impl::size (  )  [virtual]

virtual void dynamic::var_impl::unpickle ( unpickler  )  [virtual]


The documentation for this class was generated from the following file:

Generated on Thu Dec 18 22:14:19 2008 for C++Script by  doxygen 1.5.7.1