Class: OPCUA::Server::ObjectNode
- Defined in:
- lib/opcua/server.rb,
ext/opcua/server/server.c
Instance Method Summary collapse
-
#delete! ⇒ Object
{{{.
-
#find(qname) ⇒ Object
{{{.
- #find_one ⇒ Object
-
#manifest(name, parent) ⇒ Object
{{{.
Methods inherited from Node
#description, #description=, #exists?, #id, #name, #to_s
Instance Method Details
#delete! ⇒ Object
{{{
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
# File 'ext/opcua/server/server.c', line 744 static VALUE node_delete(VALUE self) { //{{{ node_struct *ns; Data_Get_Struct(self, node_struct, ns); if (!ns->exists) rb_raise(rb_eRuntimeError, "Node does not exist anymore."); UA_StatusCode retval = UA_Server_deleteNode(ns->master->master, ns->id, true); if (retval == UA_STATUSCODE_GOOD) { ns->exists = false; return Qtrue; } return Qfalse; } |
#find(qname) ⇒ Object
{{{
617 618 619 620 621 622 623 624 625 |
# File 'ext/opcua/server/server.c', line 617 def find(*what) if what.length == 0 nil elsif what.length == 1 find_one what[0] else what.map{|e| find_one e} end end |
#find_one ⇒ Object
23 |
# File 'lib/opcua/server.rb', line 23 alias_method :find_one, :find |
#manifest(name, parent) ⇒ Object
{{{
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
# File 'ext/opcua/server/server.c', line 583 static VALUE node_manifest(VALUE self, VALUE name, VALUE parent) { //{{{ node_struct *ns; node_struct *ts; if (!(rb_obj_is_kind_of(parent,cTypeTopNode) || rb_obj_is_kind_of(parent,cTypeSubNode))) { rb_raise(rb_eArgError, "argument 2 has to be a type."); } Data_Get_Struct(self, node_struct, ns); if (!ns->exists) rb_raise(rb_eRuntimeError, "Node does not exist anymore."); Data_Get_Struct(parent, node_struct, ts); if (!ns->exists) rb_raise(rb_eRuntimeError, "Target node does not exist anymore."); VALUE str = rb_obj_as_string(name); if (NIL_P(str) || TYPE(str) != T_STRING) rb_raise(rb_eTypeError, "cannot convert obj to string"); char *nstr = (char *)StringValuePtr(str); char *nidstr = strnautocat(NULL,"",1); if (ns->id.identifierType == UA_NODEIDTYPE_STRING) { nidstr = strnautocat(nidstr,(char *)ns->id.identifier.string.data,ns->id.identifier.string.length); nidstr = strnautocat(nidstr,"/",1); } nidstr = strnautocat(nidstr,nstr,strlen(nstr)); UA_NodeId n = UA_NODEID_STRING(ns->master->default_ns, nidstr); node_struct *ret = node_alloc(ns->master,n); node_struct *handle[2] = { ts, ret }; node_add_object_ua_rec(n,UA_LOCALIZEDTEXT("en-US", nstr),UA_QUALIFIEDNAME(ns->master->default_ns, nstr),ns,ts,ts->id,node_manifest_iter,(void *)handle); return Data_Wrap_Struct(CLASS_OF(self), node_mark, node_free, ret); } |