Example #1
0
		} //	end RemoveChild


		/// <summary>
		/// Gets the current value in the element's cache
		/// </summary>
		/// <param name="aValue">out parameter to be filled in with the <see cref="ValueQT"/> instance of the cache value</param>
		/// <returns>
		/// returns a result code that should be checked for success. If S_OK, the value provided is valid.
		/// </returns>
		/// <include
		///		file='TBNS.doc.xml'
		///		path='//class[@name="DaAddressSpaceElement"]/
		///		method[@name="GetCacheValue"]/doc/*'
		///	/>
		public virtual int GetCacheValue(ref ValueQT aValue)
		{
			aValue = null;
			int result = (int) EnumResultCode.E_FAIL;

			if (m_objectHandle != 0 && IoMode != EnumIoMode.NONE)
			{
				OTValueData valueData = new OTValueData();

				//	Allocate space and reset the reserved space
				valueData.m_value = Marshal.AllocCoTaskMem(ValueQT.VARIANT_SIZE);
				Marshal.GetNativeVariantForObject(null, valueData.m_value);

				result = OTBFunctions.OTSGetCacheValue(this.m_objectHandle, ref valueData);

				if (ResultCode.SUCCEEDED(result))
				{
					aValue = new ValueQT(ref valueData);
				} //	end if

				OTBFunctions.OTVariantClear(valueData.m_value);
				Marshal.FreeCoTaskMem(valueData.m_value);
			} //	end if

			return result;
		} //	end GetCacheValue