Closed danieagle closed 2 weeks ago
I presume you mean Bounded_Vectors. I'm not clear what you're asking. For the Item formal parameter, you can use any type with assignment and "=". The Item_Set formal parameter must be an array. It would be possible to replace it with a private type and operations so that it could be either an array or a vector, but that seems unnecessarily complex.
The package is implemented using unbounded vectors. Replacing these with bounded vectors would put limits on the size of patterns.
"maximum size of responses": type Result has a maximum size of a Boolean, an Index, and an Integer, plus any padding added by the compiler. Type Processed_Pattern is currently implemented with a vector (unbounded), so stack usage is constant. Heap usage is proportional to the length of the pattern.
"Max size of file searched": PragmARC.Matching.Regular_Expression does not search files; it searches within an Item_Set. An object of type Item_Set has a maximum size of Index'Last.
If this does not answer your questions, perhaps it will help you rephrase them in ways that I can more helpfully respond to.
Hi Carter! And Very Very Thanks for your hard work and care!
Yes(!) it does answer my questions, and I have some new Ones :-)
Replacing these with bounded vectors would put limits on the size of patterns => supose actual size patterns is 'Positive' (positive'last) : => Can we use a Bounded_Vectors with this maximum index limit, e.g. positive'last or others similar index ?
Type Processed_Pattern is currently implemented with a vector (unbounded), so stack usage is constant. Heap usage is proportional to the length of the pattern => Applications such as databases can benefit using PragmARC.Matching.Regular_Expression with the Bounded_Vectors:
Stack usage will continue constant, Heap usage will continue similar but with extremely less memory fragmentation
Thanks! :-)
God and Mary Blesses you, GrateFull, Dani.
=> supose actual size patterns is 'Positive' (positive'last) : => Can we use a Bounded_Vectors with this maximum index limit, e.g. positive'last or others similar index ?
That would result in allocating Positive'Last pattern items, which would probably overflow the stack.
Currently the vector representing a pattern is presized based on Pattern'Length. It would be possible to use a bounded vector with a size based on Pattern'Length for patterns. For Class items, an unbounded vector is used to hold the class elements. It would again be possible to use a bounded vector sized based on Pattern'Length, but that would make a pattern O(N**2) in space, where N = Pattern'Length.
I am happy with the package as it is for general use. If you have specific needs for which it is not appropriate, you are welcome to derive a version specific to your specialized requirements from it.
Hi J.R. Carter!
I'm just curious, Can I Use Bonded_Vector package with "PragmARC.Matching.Regular_Expression" ?
Motivation: What is the maximum size of responses returned to the client? Max size of file searched ? or ?
Very Very Very Thanks!
God Bless You, Gratefull, Dani.