model_impl.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2013-2014 by Alexander Rykovanov *
3  * rykovanov.as@gmail.com *
4  * *
5  * This library is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU Lesser General Public License as *
7  * published by the Free Software Foundation; version 3 of the License. *
8  * *
9  * This library is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU Lesser General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU Lesser General Public License *
15  * along with this library; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18  ******************************************************************************/
19 
20 #pragma once
21 
22 #include <algorithm>
23 #include <opc/ua/model.h>
24 #include <algorithm>
25 
26 namespace OpcUa
27 {
28 namespace Model
29 {
30 template <typename T>
31 std::vector<T> Browse(const NodeId & node, NodeClass nodeClassMask, Services::SharedPtr services)
32 {
33  BrowseDescription desc;
35  desc.IncludeSubtypes = true;
36  desc.NodeClasses = nodeClassMask;
38  desc.NodeToBrowse = node;
40 
41  NodesQuery query;
42  query.NodesToBrowse.push_back(desc);
43  ViewServices::SharedPtr views = services->Views();
44  std::vector<BrowseResult> results = views->Browse(query);
45 
46  std::vector<T> objects;
47  std::for_each(results[0].Referencies.begin(), results[0].Referencies.end(), [&node, &services, &objects](const ReferenceDescription & ref)
48  {
49  objects.push_back(T(ref.TargetNodeId, services));
50  });
51 
52  return objects;
53 }
54 }
55 }
std::vector< BrowseDescription > NodesToBrowse
Definition: protocol/view.h:50
std::vector< T > Browse(const NodeId &node, NodeClass nodeClassMask, Services::SharedPtr services)
Definition: model_impl.h:31
objects
Definition: client.py:46
OPC UA Address space part. GNU LGPL.
BrowseResultMask ResultMask
Definition: protocol/view.h:41
NodeClass
Definition: enums.h:39
BrowseDirection Direction
Definition: protocol/view.h:37


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:12:06