コード例 #1
0
ファイル: CompactMeasurement.cs プロジェクト: sttp/gsfapi
        /// <summary>
        /// Creates a new <see cref="CompactMeasurement"/>.
        /// </summary>
        /// <param name="signalIndexCache">Signal index cache used to serialize or deserialize runtime information.</param>
        /// <param name="includeTime">Set to <c>true</c> to include time in serialized packet; otherwise <c>false</c>.</param>
        /// <param name="baseTimeOffsets">Base time offset array - set to <c>null</c> to use full fidelity measurement time.</param>
        /// <param name="timeIndex">Time index to use for base offset.</param>
        /// <param name="useMillisecondResolution">Flag that determines if millisecond resolution is in use for this serialization.</param>
        public CompactMeasurement(SignalIndexCache signalIndexCache, bool includeTime = true, long[] baseTimeOffsets = null, int timeIndex = 0, bool useMillisecondResolution = false)
        {
            m_signalIndexCache = signalIndexCache;
            IncludeTime        = includeTime;

            // We keep a clone of the base time offsets, if provided, since array contents can change at any time
            m_baseTimeOffsets          = baseTimeOffsets is null ? s_emptyBaseTimeOffsets : new[] { baseTimeOffsets[0], baseTimeOffsets[1] };
            m_timeIndex                = timeIndex;
            m_useMillisecondResolution = useMillisecondResolution;
        }
コード例 #2
0
        /// <summary>
        /// Creates a new local system cache from one that was received remotely.
        /// </summary>
        /// <param name="dataSource"><see cref="DataSet"/> based data source used to interpret local measurement keys.</param>
        /// <param name="remoteCache">Deserialized remote signal index cache.</param>
        public SignalIndexCache(DataSet dataSource, SignalIndexCache remoteCache)
        {
            m_subscriberID = remoteCache.SubscriberID;

            // If active measurements are defined, interpret signal cache in context of current measurement key definitions
            if (dataSource is null || !dataSource.Tables.Contains("ActiveMeasurements"))
            {
                // Just use remote signal index cache as-is if no local configuration exists
                Reference = remoteCache.Reference;
                m_unauthorizedSignalIDs = remoteCache.UnauthorizedSignalIDs;
            }