Reputation: 1099
Is there a Thrift syntax for this declaration TAO IDL?
typedef sequence< SomeClass, 31 > SomeSeq;
It means that SomeClass should appear maximum 31 times. I am working with Thrift in C++.
Upvotes: 0
Views: 153
Reputation: 13421
Short answer: No.
There is no restriction possible at the IDL level. If you need functionality like that the recommended way is to handle it in the biz logic or wherever else it makes sense in your architecture.
The alternative, but rather cumbersome way would be sth like
struct cumbersome {
1: optional SomeClass elm0
2: optional SomeClass elm1
3: optional SomeClass elm2
// ... some more elements omitted ...
28: optional SomeClass elm29
29: optional SomeClass elm30
30: optional SomeClass elm31
}
I can't really recommend this, and it is not even a list<>
construct anymore, but technically it would solve the task to limit the number of elements.
Upvotes: 1