IntdashDataFileManager
public class IntdashDataFileManager : Codable
IntdashData をファイルシステム上で管理するクラス。
指定したディレクトリへ IntdashData を書き出したり、読み込んだりすることができます。
書き出しには、 IntdashDataFileManager.write(units:elapsedTime:withUpdateDataSize:) を使用することができます。
書き出された IntdashData は、1秒ごとに1セットとして扱われます。
同一秒のセットのなかで、さらに同一経過時間をもつものどうしで一つにまとめられ、小さい方から順に、indexを割り振られます。
保存されている IntdashData は、 IntdashDataFileManager.read(elapsedTime:index:completion:) により、
取得対象の秒数およびindexを指定して取得することができます。
-
データを保存する親パス(ディレクトリのパス)。
Declaration
Swift
public private(set) var parentPath: String -
格納されたデータの総データサイズ。
Declaration
Swift
public var dataSize: UInt64 { get } -
格納したデータが紐づく1つめの基準時刻(通常、EdgeRTCより取得した基準時刻が使用されることを想定)。
Declaration
Swift
public var baseTime: TimeInterval? -
baseTimeを設定します。 なお、ファイルへの保存も同時に行います。Declaration
Swift
public func setBaseTime(time: TimeInterval?) throwsParameters
time基準時刻
-
格納したデータが紐づく2つめの基準時刻(通常、NTP等より取得した基準時刻が使用されることを想定)。
Declaration
Swift
public var baseTime2: TimeInterval? -
baseTime2を設定します。 なお、ファイルへの保存も同時に行います。Declaration
Swift
public func setBaseTime2(time: TimeInterval?) throwsParameters
time基準時刻
-
格納したデータが紐づく計測のUUID。
Declaration
Swift
public var measurementId: String? -
measurementIdを設定します。なお、ファイルへの保存も同時に行います。Declaration
Swift
public func setMeasurementId(id: String) throwsParameters
id計測のUUID
-
格納したデータが紐づくチャンネル番号。
Declaration
Swift
public var streamChannels: Int? -
streamChannelsを設定します。なお、ファイルへの保存も同時に行います。Declaration
Swift
public func setStreamChannels(channels: Int?) throwsParameters
channelsストリーム用チャンネル番号
-
格納したデータの期間(格納した時系列データがどのくらいの時間的長さをもつか)。
getDataDuration()と異なり、利用者により任意の値を設定することができます。Declaration
Swift
public var duration: TimeInterval? -
durationを設定します。なお、ファイルへの保存も同時に行います。Declaration
Swift
public func setDuration(duration: TimeInterval?) throwsParameters
duration期間
-
格納したデータをサーバーにアップロードしたか。
Declaration
Swift
public var isUploaded: Bool -
isUploadedをセットします。なお、ファイルへの保存も同時に行います。Declaration
Swift
public func setUploadFlag(flag: Bool) throwsParameters
flagフラグ
-
メタ情報として仕様可能な任意の文字列。
Declaration
Swift
public var string: String? -
stringに文字列をセットします。なお、ファイルへの保存も同時に行います。Declaration
Swift
public func setString(str: String?) throwsParameters
str任意の文字列
-
IntdashDataFileManagerを生成します。
Declaration
Swift
public required init(from decoder: Decoder) throwsParameters
fromDecoder
-
Declaration
Swift
public func encode(to encoder: Encoder) throws -
IntdashDataFileManagerを生成します。
Declaration
Swift
public init(parentPath: String, isOverwrite: Bool = false) throwsParameters
parentPathデータを保存する親パス(ディレクトリのパス)
isOverwirte上書きを許可するか
-
指定したパスからデータをロードして、IntdashDataFileManagerを生成します。
Declaration
Swift
public static func load(parentPath: String) throws -> IntdashDataFileManagerParameters
parentPathデータが保存されている親パス(ディレクトリのパス)
Return Value
IntdashDataFileManager
-
保持しているデータを書き出します。
Declaration
Swift
public func write() throws -
格納したデータを除去します。
Declaration
Swift
public func remove() throws -
指定されたパスに格納したデータを除去します。
Declaration
Swift
public static func remove(parentPath: String) throwsParameters
parentPathデータを削除する親パス(ディレクトリのパス)
-
保持しているデータをクリアします。
Declaration
Swift
public func clear() throws -
タイムスタンプ(絶対時刻)を使用して、
IntdashDataを書き込みます。Declaration
Swift
@discardableResult public func write(units: [IntdashData], timestamp: TimeInterval, withUpdateDataSize: Bool = true) throws -> IntParameters
units書き込む
IntdashDataの配列timestampタイムスタンプ(絶対時刻)
withUpdateDataSize書き込んだ総データサイズを同時に書き込むか
Return Value
書き込んだ総データサイズ
-
相対時間を指定して、
IntdashDataを書き込みます。Declaration
Swift
@discardableResult public func write(units: [IntdashData], elapsedTime: TimeInterval, withUpdateDataSize: Bool = true) throws -> IntParameters
units書き込む
IntdashDataの配列elapsedTime相対時間
withUpdateDataSize書き込んだ総データサイズを同時に書き込むか
Return Value
書き込んだ総データサイズ
-
ある経過時間に保存された複数の
IntdashDataのうち、index番目のものを取得します。Declaration
Swift
public func read(elapsedTime: Int, index: Int, completion: @escaping (_ error: Error?, _ units: [IntdashData]?, _ timestamp: TimeInterval?) -> ())Parameters
elapsedTime取得対象とする経過時間
index取得対象とする経過時間に格納された複数の
IntdashDataのうち、何番目のものを取得対象とするかcompletion処理完了時のコールバック
errorエラー情報
units取得した
IntdashDataの配列timestamp取得した
IntdashDataに対応するタイムスタンプ -
保存されているデータが持つデータの期間を算出します。
durationと異なり、保存されているデータが持つ情報から、期間を算出します。Declaration
Swift
public func getDataDuration() -> IntReturn Value
保存されているデータの期間(秒)
-
指定されたパスに保存されているデータが持つデータの期間を算出します。
Declaration
Swift
public static func getDataDuration(parentPath: String) -> IntParameters
parentPathデータが配置されている親パス(ディレクトリのパス)
Return Value
保存されているデータの期間(秒)
-
その経過時間に対して保存されている
IntdashDataの数を取得します。Declaration
Swift
public func getUnitSizePerSecond(elapsedTime: Int) -> IntParameters
elapsedTime取得対象とする経過時間
Return Value
その経過時間に保存されている
IntdashDataの数 -
指定されたパスから、その経過時間に対して保存されている
IntdashDataの数を取得します。Declaration
Swift
public static func getUnitSizePerSecond(parentPath: String, elapsedTime: Int) -> IntParameters
parentPath取得対象とする親パス
elapsedTime取得対象とする経過時間
Return Value
その経過時間に保存されている
IntdashDataの数 -
保存されているデータを移動します。
Declaration
Swift
public func move(toParentPath: String) throwsParameters
toParentPath移動先親パス
-
指定されたパスからパスへ、保存されているデータを移動します。
Declaration
Swift
public static func move(fromParentPath: String, toParentPath: String) throwsParameters
fromParentPath移動前親パス
toParentPath移動先親パス
-
保存されているデータを移動します。
Declaration
Swift
public func move(toParentPath: String, isOverwrite: Bool) throwsParameters
toParentPath移動先親パス
isOverwrite上書きを許可するか
-
指定されたパスからパスへ、保存されているデータを移動します。
Declaration
Swift
public static func move(fromParentPath: String, toParentPath: String, isOverwrite: Bool) throwsParameters
fronParentPath移動前親パス
toParentPath移動先親パス
isOverwrite上書きを許可するか
-
保存されているデータをコピーします。
Declaration
Swift
public func copy(toParentPath: String) throwsParameters
toParentPathコピー先親パス
-
指定されたパスからパスへ、保存されているデータをコピーします。
Declaration
Swift
public static func copy(fromParentPath: String, toParentPath: String) throwsParameters
fromParentPathコピーする親パス
toParentPathコピー先親パス
-
保存されているデータをコピーします。
Declaration
Swift
public func copy(toParentPath: String, isOverwrite: Bool) throwsParameters
toParentPathコピー先親パス
isOverwrite上書きを許可するか
-
指定されたパスからパスへ、保存されているデータをコピーします。
Declaration
Swift
public static func copy(fromParentPath: String, toParentPath: String, isOverwrite: Bool) throwsParameters
fromParentPathコピーする親パス
toParentPathコピー先親パス
isOverwrite上書きを許可するか
IntdashDataFileManager Class Reference