MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.basecode.RawProto Class Reference

The RawProto class is used to parse and output Google prototxt file data. More...

Public Types

enum  TYPE { NONE , NUMERIC , STRING }
 Defines the type of a RawProto node. More...
 

Public Member Functions

 RawProto (string strName, string strValue, RawProtoCollection rgChildren=null, TYPE type=TYPE.NONE)
 The RawProto constructor. More...
 
string FindValue (string strName)
 Searches for a falue of a node within this nodes children. More...
 
object FindValue (string strName, Type t)
 Searches for a value of a node within this nodes children and return it as a given type. More...
 
List< T > FindArray< T > (string strName)
 Searches for all values of a given name within this nodes children and return it as a generic List. More...
 
bool RemoveChild (RawProto p)
 Removes a given child from this node's children. More...
 
bool RemoveChild (string strName, string strValue, bool bContains=false)
 Removes a given child with a set value from this node's children. More...
 
RawProto FindChild (string strName)
 Searches for a given node. More...
 
int FindChildIndex (string strName)
 Searches for the index to a given node's child. More...
 
RawProtoCollection FindChildren (params string[] rgstrName)
 Searches for all children with a given name in this node's children. More...
 
void ToFile (string strFileName)
 Saves a RawProto to a file. More...
 
override string ToString ()
 Returns the RawProto as its full prototxt string. More...
 

Static Public Member Functions

static RawProto FromFile (string strFileName)
 Parses a prototxt from a file and returns it as a RawProto. More...
 
static RawProto Parse (string str)
 Parses a prototxt and places it in a new RawProto. More...
 

Properties

string Name [get]
 Returns the name of the node. More...
 
string Value [getset]
 Get/set the value of the node. More...
 
TYPE Type [get]
 Returns the type of the node. More...
 
RawProtoCollection Children [get]
 Returns a collection of this nodes child nodes. More...
 

Detailed Description

The RawProto class is used to parse and output Google prototxt file data.

Each RawProto instance forms a tree of RawProto instances where each Leaf contains the data and branches contain a collection of child RawProto's.

Definition at line 16 of file RawProto.cs.

Member Enumeration Documentation

◆ TYPE

Defines the type of a RawProto node.

Enumerator
NONE 

Brach node.

NUMERIC 

Numeric leaf node.

STRING 

Numeric string node.

Definition at line 26 of file RawProto.cs.

Constructor & Destructor Documentation

◆ RawProto()

MyCaffe.basecode.RawProto.RawProto ( string  strName,
string  strValue,
RawProtoCollection  rgChildren = null,
TYPE  type = TYPE.NONE 
)

The RawProto constructor.

Parameters
strNameSpecifies the name of the node.
strValueSpecifies the value of the node.
rgChildrenSpecifies the children nodes of this node (if any).
typeSpecifies the type of the node.

Definition at line 57 of file RawProto.cs.

Member Function Documentation

◆ FindArray< T >()

List< T > MyCaffe.basecode.RawProto.FindArray< T > ( string  strName)

Searches for all values of a given name within this nodes children and return it as a generic List.

Template Parameters
TSpecifies the type of item to return.
Parameters
strNameSpecifies the name of the nodes to look for.
Returns
If found, the generic List of values of the children found is returned.

Definition at line 138 of file RawProto.cs.

◆ FindChild()

RawProto MyCaffe.basecode.RawProto.FindChild ( string  strName)

Searches for a given node.

Parameters
strNameSpecifies the name of the node to look for.
Returns
If found, the node is returned, otherwise null is returned.

Definition at line 231 of file RawProto.cs.

◆ FindChildIndex()

int MyCaffe.basecode.RawProto.FindChildIndex ( string  strName)

Searches for the index to a given node's child.

Parameters
strNameSpecifies the name of the child node to look for.
Returns
If found, the index of the child node is returned, otherwise -1 is returned.

Definition at line 247 of file RawProto.cs.

◆ FindChildren()

RawProtoCollection MyCaffe.basecode.RawProto.FindChildren ( params string[]  rgstrName)

Searches for all children with a given name in this node's children.

Parameters
rgstrNameSpecifies a array of names to look for.
Returns
The collection of child nodes found is returned.

Definition at line 263 of file RawProto.cs.

◆ FindValue() [1/2]

string MyCaffe.basecode.RawProto.FindValue ( string  strName)

Searches for a falue of a node within this nodes children.

Parameters
strNameSpecifies the name of the node to look for.
Returns
If found, the value of the child is returned, otherwise null is returned.

Definition at line 105 of file RawProto.cs.

◆ FindValue() [2/2]

object MyCaffe.basecode.RawProto.FindValue ( string  strName,
Type  t 
)

Searches for a value of a node within this nodes children and return it as a given type.

Parameters
strNameSpecifies the name of the node to look for.
tSpecifies the type to convert the value, if found.
Returns
If found, the value of the child is returned, otherwise null is returned.

Definition at line 122 of file RawProto.cs.

◆ FromFile()

static RawProto MyCaffe.basecode.RawProto.FromFile ( string  strFileName)
static

Parses a prototxt from a file and returns it as a RawProto.

Parameters
strFileNameSpecifies the file name.
Returns
The new RawProto is returned.

Definition at line 281 of file RawProto.cs.

◆ Parse()

static RawProto MyCaffe.basecode.RawProto.Parse ( string  str)
static

Parses a prototxt and places it in a new RawProto.

Parameters
strSpecifies the prototxt to parse.
Returns
The new RawProto is returned.

Definition at line 306 of file RawProto.cs.

◆ RemoveChild() [1/2]

bool MyCaffe.basecode.RawProto.RemoveChild ( RawProto  p)

Removes a given child from this node's children.

Parameters
pSpecifies the RawProto to remove.
Returns
If found and removed, true is returned, otherwise false is returned.

Definition at line 188 of file RawProto.cs.

◆ RemoveChild() [2/2]

bool MyCaffe.basecode.RawProto.RemoveChild ( string  strName,
string  strValue,
bool  bContains = false 
)

Removes a given child with a set value from this node's children.

Parameters
strNameSpecifes the name of the node.
strValueSpecifies the value to match.
bContainsOptionally, specifies whether just 'containing' the value (as opposed to equallying the value) is enough to delete the bottom.
Returns
If the named node is found and its value matches strValue, true is returned, otherwise false is returned.

Definition at line 200 of file RawProto.cs.

◆ ToFile()

void MyCaffe.basecode.RawProto.ToFile ( string  strFileName)

Saves a RawProto to a file.

Parameters
strFileNameSpecifies the file name.

Definition at line 293 of file RawProto.cs.

◆ ToString()

override string MyCaffe.basecode.RawProto.ToString ( )

Returns the RawProto as its full prototxt string.

Returns
The full prototxt string representing the RawProto is returned.

Definition at line 681 of file RawProto.cs.

Property Documentation

◆ Children

RawProtoCollection MyCaffe.basecode.RawProto.Children
get

Returns a collection of this nodes child nodes.

Definition at line 95 of file RawProto.cs.

◆ Name

string MyCaffe.basecode.RawProto.Name
get

Returns the name of the node.

Definition at line 70 of file RawProto.cs.

◆ Type

TYPE MyCaffe.basecode.RawProto.Type
get

Returns the type of the node.

Definition at line 87 of file RawProto.cs.

◆ Value

string MyCaffe.basecode.RawProto.Value
getset

Get/set the value of the node.

Definition at line 78 of file RawProto.cs.


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