VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
entityValidation.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <vlutil/vlString.h>
12 #include <vlutil/vlFilename.h>
13 #include <memory>
14 
20 {
21  DtFilename file;
24  std::shared_ptr<const DtSysdefContext> parent;
25 };
26 
30 struct DtVariable
31 {
33  std::shared_ptr<const DtSysdefContext> context;
34 };
35 
38 {
39 public:
40  explicit DtEntityValidationCollector(std::vector<DtVariable>& unusedBindings,
41  std::vector<DtVariable>& hiddenVariables)
42  : myUnusedBindings(unusedBindings)
43  , myHiddenVariables(hiddenVariables)
44  {}
45 
46  std::vector<DtVariable>& unusedBindings() { return myUnusedBindings; }
47  std::vector<DtVariable>& hiddenVariables() { return myHiddenVariables; }
48 
50  const std::shared_ptr<DtSysdefContext>& currentContext() const { return myCurrentContext; }
51 
53  void setRootContext(std::shared_ptr<DtSysdefContext> ctx) { myCurrentContext = std::move(ctx); }
54 
58  DtSysdefContext* pushContext(const DtString& listName, const DtString& descriptorName)
59  {
60  auto child = std::make_shared<DtSysdefContext>();
61  child->listName = listName;
62  child->descriptorName = descriptorName;
63  child->parent = myCurrentContext;
64  myCurrentContext = child;
65  return myCurrentContext.get();
66  }
67 
69  void popContext()
70  {
71  if (myCurrentContext)
72  myCurrentContext = std::const_pointer_cast<DtSysdefContext>(myCurrentContext->parent);
73  }
74 
75 private:
76  std::vector<DtVariable>& myUnusedBindings;
77  std::vector<DtVariable>& myHiddenVariables;
78  std::shared_ptr<DtSysdefContext> myCurrentContext;
79 };
std::vector< DtVariable > & myUnusedBindings
Definition: entityValidation.h:76
Collects entity validation issues produced during sysdef loading.
Definition: entityValidation.h:37
DtSysdefContext * pushContext(const DtString &listName, const DtString &descriptorName)
Push a new child context for a descriptor being loaded. Returns a non-owning pointer to the new node ...
Definition: entityValidation.h:58
DtString variableName
Definition: entityValidation.h:32
DtEntityValidationCollector(std::vector< DtVariable > &unusedBindings, std::vector< DtVariable > &hiddenVariables)
Definition: entityValidation.h:40
std::shared_ptr< const DtSysdefContext > parent
null at root
Definition: entityValidation.h:24
Represents either an unused variable binding or a hidden variable discovered during sysdef loading...
Definition: entityValidation.h:30
One node in the sysdef nesting chain. The root node represents the .entity file (listName and descrip...
Definition: entityValidation.h:19
std::vector< DtVariable > & unusedBindings()
Definition: entityValidation.h:46
std::vector< DtVariable > & hiddenVariables()
Definition: entityValidation.h:47
std::shared_ptr< DtSysdefContext > myCurrentContext
Definition: entityValidation.h:78
std::vector< DtVariable > & myHiddenVariables
Definition: entityValidation.h:77
std::shared_ptr< const DtSysdefContext > context
the context in which this variable was found
Definition: entityValidation.h:33
DtFilename file
full path: entity file at root, loaded sysdef elsewhere
Definition: entityValidation.h:21
const std::shared_ptr< DtSysdefContext > & currentContext() const
The current context node (shared with any DtVariables emitted during this level). ...
Definition: entityValidation.h:50
DtString listName
name of the systems list, e.g. &quot;systems&quot;; empty at root
Definition: entityValidation.h:22
void popContext()
Pop back to the parent context.
Definition: entityValidation.h:69
void setRootContext(std::shared_ptr< DtSysdefContext > ctx)
Replace the root context (called once by vrfObjectParameters with the entity file).
Definition: entityValidation.h:53
DtString descriptorName
name of the descriptor entry, e.g. &quot;coax-mg&quot;; empty at root
Definition: entityValidation.h:23

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)