3using System.Collections.Generic;
7using System.Threading.Tasks;
17 string[] m_rgstrFiles;
47 get {
return "StdTextFileQuery"; }
82 string[] rgstrFiles = Directory.GetFiles(m_strPath);
85 List<string> rgstr =
new List<string>();
87 for (
int i = 0; i < rgstrFiles.Length; i++)
89 FileInfo fi =
new FileInfo(rgstrFiles[i]);
91 if (fi.Extension.ToLower() ==
".txt")
92 rgstr.Add(rgstrFiles[i]);
95 m_rgstrFiles = rgstr.ToArray();
97 if (m_rgstrFiles.Length == 0)
98 throw new Exception(
"The CustomTextQuery could not find any text (*.txt) files to load.");
110 throw new NotImplementedException();
119 if (m_nFileIdx == m_rgstrFiles.Length)
122 using (StreamReader sr =
new StreamReader(m_rgstrFiles[m_nFileIdx]))
125 return Encoding.ASCII.GetBytes(sr.ReadToEnd());
135 throw new NotImplementedException();
144 throw new NotImplementedException();
162 if (m_nFileIdx == m_rgstrFiles.Length)
165 List<int> rgSize =
new List<int>();
170 FileInfo fi =
new FileInfo(m_rgstrFiles[m_nFileIdx]);
171 rgSize.Add((
int)fi.Length);
192 using (MemoryStream ms =
new MemoryStream())
196 for (
int i = 0; i < rg.Length; i++)
198 int nVal = (int)Convert.ChangeType(rg[i], typeof(
int));
199 char ch = (char)nVal;
200 ms.WriteByte((
byte)ch);
Specifies a key-value pair of properties.
string GetProperty(string strName, bool bThrowExceptions=true)
Returns a property as a string value.
The ParamPacker is use to pack and unpack parameters sent to each custom query.
static string UnPack(string str)
Unpack the custom query parameters.
The StandardQueryTextFile provides queries that read text (*.txt) files residing in a given directory...
CUSTOM_QUERY_TYPE QueryType
Returns the QUERY_TYPE of BYTE.
IXCustomQuery Clone(string strParam)
Clone the custom query returning a new copy.
List< int > GetQuerySize()
The GetQuerySize method returns the size of the query as {1,1,filesize}.
void Close()
Close the custom query.
void Reset()
Reset the file index to the first file.
StandardQueryTextFile(string strParam=null)
The constructor.
double[] QueryByTime(DateTime dt, TimeSpan ts, int nCount)
The QueryByTime method is not implemented for this custom query.
byte[] QueryBytes()
The QueryBytes method returns the bytes of the next file in the directory.
byte[] ConvertOutput(float[] rg, out string strType)
Converts the output values into the native type used by the CustomQuery.
Dictionary< string, float > QueryInfo()
The Query information returns information about the data queried such as header information.
int FieldCount
Returns the field count of 1.
string Name
Returns the custom query name 'StdTextFileQuery'.
List< float[]> QueryRealF()
The QueryRealF method is not implemented for this custom query.
List< double[]> QueryRealD()
The QueryRealD method is not implemented for this custom query.
void Open()
Open the custom query. The query must be opened before calling QueryBytes.
The custom query interface defines the functions implemented by each Custom Query object used to spec...
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.db.stream namespace contains all data streaming related classes.
CUSTOM_QUERY_TYPE
Defines the custom query type to use.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...