public void LogVarValue(Agent pAgent, string name, object value) { #if !BEHAVIAC_RELEASE if (Config.IsLoggingOrSocketing) { string valueStr = StringUtils.ToString(value); string typeName = ""; if (!Object.ReferenceEquals(value, null)) { typeName = Utils.GetNativeTypeName(value.GetType()); } else { typeName = "Agent"; } string full_name = name; if (!Object.ReferenceEquals(pAgent, null)) { CMemberBase pMember = pAgent.FindMember(name); if (pMember != null) { string classFullName = pMember.GetClassNameString().Replace(".", "::"); full_name = string.Format("{0}::{1}", classFullName, name); } } LogManager.Instance.Log(pAgent, typeName, full_name, valueStr); } #endif }
public void Log(Agent pAgent) { string value = StringUtils.ToString(this.m_value); string typeName = string.Empty; if (!object.ReferenceEquals(this.m_value, null)) { typeName = Utils.GetNativeTypeName(this.m_value.GetType()); } else { typeName = "Agent"; } string varName = this.m_name; if (!object.ReferenceEquals(pAgent, null)) { CMemberBase cMemberBase = pAgent.FindMember(this.m_name); if (cMemberBase != null) { string text = cMemberBase.GetClassNameString().Replace(".", "::"); varName = string.Format("{0}::{1}", text, this.m_name); } } LogManager.Log(pAgent, typeName, varName, value); }
public void Log(Agent pAgent) { //BEHAVIAC_ASSERT(this.m_changed); string valueStr = StringUtils.ToString(this.m_value); string typeName = ""; if (!Object.ReferenceEquals(this.m_value, null)) { typeName = Utils.GetNativeTypeName(this.m_value.GetType()); } else { typeName = "Agent"; } string full_name = this.m_name; if (!Object.ReferenceEquals(pAgent, null)) { CMemberBase pMember = pAgent.FindMember(this.m_name); if (pMember != null) { string classFullName = pMember.GetClassNameString().Replace(".", "::"); full_name = string.Format("{0}::{1}", classFullName, this.m_name); } } LogManager.Log(pAgent, typeName, full_name, valueStr); #if !BEHAVIAC_RELEASE this.m_changed = false; #endif }
public void Set(Agent pAgent, CMemberBase pMember, string variableName, object value, uint varId) { if (varId == 0u) { varId = Utils.MakeVariableId(variableName); } IVariable variable = null; if (!this.m_variables.TryGetValue(varId, out variable)) { if (pMember == null) { if (pAgent != null) { pMember = pAgent.FindMember(variableName); } else { pMember = Agent.FindMemberBase(variableName); } } variable = new IVariable(pMember, variableName, varId); this.m_variables.Add(varId, variable); } variable.SetValue(value, pAgent); }
public object Get(Agent pAgent, uint varId) { IVariable variable = null; if (this.m_variables.TryGetValue(varId, out variable)) { Property property = variable.GetProperty(); if (property != null) { string refName = property.GetRefName(); if (!string.IsNullOrEmpty(refName)) { return(this.Get(pAgent, property.GetRefNameId())); } } return(variable.GetValue(pAgent)); } CMemberBase cMemberBase = pAgent.FindMember(varId); if (cMemberBase != null) { return(cMemberBase.Get(pAgent)); } return(null); }
public void SetFromString(Agent pAgent, string variableName, string valueStr) { string nameWithoutClassName = Utils.GetNameWithoutClassName(variableName); CMemberBase pMember = pAgent.FindMember(nameWithoutClassName); uint key = Utils.MakeVariableId(nameWithoutClassName); IVariable variable = null; if (this.m_variables.TryGetValue(key, out variable)) { variable.SetFromString(pAgent, pMember, valueStr); } }
public void SetFromString(Agent pAgent, string variableName, string valueStr) { Debug.Check(!string.IsNullOrEmpty(variableName)); //to skip class name string variableNameOnly = Utils.GetNameWithoutClassName(variableName); CMemberBase pMember = pAgent.FindMember(variableNameOnly); uint varId = Utils.MakeVariableId(variableNameOnly); if (this.m_variables.ContainsKey(varId)) { IVariable pVar = this.m_variables[varId]; pVar.SetFromString(pAgent, pMember, valueStr); } }
public object Get(Agent pAgent, uint varId) { if (!this.m_variables.ContainsKey(varId)) { //possible static property CMemberBase pMember = pAgent.FindMember(varId); if (pMember != null) { object pAddr = pMember.Get(pAgent); return(pAddr); } Debug.Check(false, "a compatible property is not found"); } else { //par IVariable pVar = this.m_variables[varId]; { Property refPropety = pVar.GetProperty(); if (refPropety != null) { string refName = refPropety.GetRefName(); if (!string.IsNullOrEmpty(refName)) { return(this.Get(pAgent, refPropety.GetRefNameId())); } } return(pVar.GetValue(pAgent)); } } return(null); }
public object Get(Agent pAgent, uint varId) { IVariable variable = null; if (!this.m_variables.TryGetValue(varId, out variable)) { CMemberBase base2 = pAgent.FindMember(varId); if (base2 != null) { return(base2.Get(pAgent)); } } else { Property property = variable.GetProperty(); if ((property != null) && !string.IsNullOrEmpty(property.GetRefName())) { return(this.Get(pAgent, property.GetRefNameId())); } return(variable.GetValue(pAgent)); } return(null); }
public void Set(Agent pAgent, CMemberBase pMember, string variableName, object value, uint varId) { Debug.Check(!string.IsNullOrEmpty(variableName)); if (varId == 0) { varId = Utils.MakeVariableId(variableName); } IVariable pVar = null; if (!this.m_variables.ContainsKey(varId)) { if (pMember == null) { if (pAgent != null) { pMember = pAgent.FindMember(variableName); } else { pMember = Agent.FindMemberBase(variableName); } } pVar = new IVariable(pMember, variableName, varId); behaviac.Debug.Check(pVar != null); m_variables[varId] = pVar; } else { pVar = this.m_variables[varId]; } pVar.SetValue(value, pAgent); }