1 /*==========================================================================
2 SeqAn - The Library for Sequence Analysis
4 ============================================================================
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 3 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 ============================================================================
18 $Id: basic_alphabet_interface.h,v 1.1 2008/08/25 16:20:01 langmead Exp $
19 ==========================================================================*/
21 #ifndef SEQAN_HEADER_BASIC_ALPHABET_INTERFACE_H
22 #define SEQAN_HEADER_BASIC_ALPHABET_INTERFACE_H
26 namespace SEQAN_NAMESPACE_MAIN
28 //////////////////////////////////////////////////////////////////////////////
30 //////////////////////////////////////////////////////////////////////////////
33 .Metafunction.IsSimple:
34 ..summary:Tests type to be simple.
35 ..signature:IsSimple<T>::Type
36 ..param.T:Type that is tested.
37 ..returns.param.Type:@Tag.Logical Values.True@, if $T$ is a simple type, @Tag.Logical Values.False@ otherwise.
38 ...default:@Tag.Logical Values.False@
39 ..remarks:A simple type is a type that does not need constructors to be created,
40 a destructor to be destroyed, and copy assignment operators or copy constructors
41 to be copied. All POD ("plain old data") types are simple, but some
42 non-POD types could be simple too, e.g. some specializations of @Class.SimpleType@.
43 ..see:Class.SimpleType
53 public _IsSimple<T> {};
55 struct IsSimple<T const>:
56 public IsSimple<T> {};
58 //////////////////////////////////////////////////////////////////////////////
59 //very basic Alphabets
62 typedef unsigned char Byte;
63 typedef wchar_t Unicode;
65 //////////////////////////////////////////////////////////////////////////////
68 .Function.valueConstruct:
69 ..cat:Content Manipulation
70 ..summary:Constructs an object at specified position.
71 ..signature:valueConstruct(iterator [, param [, move_tag] ])
72 ..param.iterator:Pointer or iterator to position where the object should be constructed.
73 ..param.param:Parameter that is forwarded to constructor. (optional)
74 ..param.move_tag:Instance of the @Tag.Move Switch.move switch tag@. (optional)
75 ...remarks:If the @Tag.Move Switch.move switch tag@ is specified, it is forwarded to the constructor,
76 so the constructed object must support move construction.
77 ..remarks:The type of the destructed object is the @Metafunction.Value.value type@ of $iterator$.
80 struct _ValueConstructor
82 template <typename TIterator>
84 construct(TIterator it)
86 typedef typename Value<TIterator>::Type TValue;
87 new( & value(it) ) TValue;
90 template <typename TIterator, typename TParam>
92 construct(TIterator it,
93 TParam const & param_)
95 typedef typename Value<TIterator>::Type TValue;
96 new( & value(it) ) TValue(param_);
99 template <typename TIterator, typename TParam>
101 construct(TIterator it,
102 TParam const & param_,
105 typedef typename Value<TIterator>::Type TValue;
106 new( & value(it) ) TValue(param_, tag);
110 struct _ValueConstructorProxy
112 template <typename TIterator>
113 static inline void construct(TIterator) {}
115 template <typename TIterator, typename TParam>
116 static inline void construct(TIterator, TParam const &) {}
118 template <typename TIterator, typename TParam>
119 static inline void construct(TIterator, TParam const &, Move) {}
122 //____________________________________________________________________________
124 struct _ValueDestructor
126 template <typename TIterator>
128 destruct(TIterator it)
130 typedef typename Value<TIterator>::Type TValue;
134 struct _ValueDestructorProxy
136 template <typename TIterator>
137 static inline void destruct(TIterator) {}
140 //____________________________________________________________________________
142 template <typename TIterator>
144 valueConstruct(TIterator it)
149 typename Value<TIterator>::Type &,
150 typename Reference<TIterator>::Type
153 _ValueConstructor, // true, types are equal
155 _ValueConstructorProxy // false, types differ -> value() returns a proxy
156 >::Type TConstructor;
158 TConstructor::construct(it);
161 template <typename TIterator, typename TParam>
163 valueConstruct(TIterator it,
164 TParam const & param_)
169 typename Value<TIterator>::Type &,
170 typename Reference<TIterator>::Type
173 _ValueConstructor, // true, types are equal
175 _ValueConstructorProxy // false, types differ -> value() returns a proxy
176 >::Type TConstructor;
178 TConstructor::construct(it, param_);
181 template <typename TIterator, typename TParam>
183 valueConstruct(TIterator it,
184 TParam const & param_,
190 typename Value<TIterator>::Type &,
191 typename Reference<TIterator>::Type
194 _ValueConstructor, // true, types are equal
196 _ValueConstructorProxy // false, types differ -> value() returns a proxy
197 >::Type TConstructor;
199 TConstructor::construct(it, param_, tag);
202 //////////////////////////////////////////////////////////////////////////////
205 .Function.valueDestruct:
206 ..cat:Content Manipulation
207 ..summary:Destoys an object at specified position.
208 ..signature:valueDestruct(iterator)
209 ..param.iterator:Pointer or iterator to position where the object should be constructed.
210 ..remarks:The type of the constructed object is the @Metafunction.Value.value type@ of $iterator$.
211 ..see:Function.valueConstruct
213 template <typename TIterator>
215 valueDestruct(TIterator it)
220 typename Value<TIterator>::Type &,
221 typename Reference<TIterator>::Type
224 _ValueDestructor, // true, types are equal
226 _ValueDestructorProxy // false, types differ -> value() returns a proxy
229 TDestructor::destruct(it);
233 //////////////////////////////////////////////////////////////////////////////
236 .Function.valueConstructMove:
237 ..cat:Content Manipulation
238 ..summary:Move constructs an object at specified position.
239 ..signature:valueConstructMove(iterator, param)
240 ..param.iterator:Pointer or iterator to position where the object should be constructed.
241 ..param.param:Parameter that is moved to the new constructed object.
242 ..remarks:The type of the destructed object is the @Metafunction.Value.value type@ of $iterator$.
243 ..remarks:The default implementation just calls @Function.valueConstruct@.
245 template <typename TIterator, typename TValue>
247 valueConstructMove(TIterator it, TValue const & value)
249 valueConstruct(it, value);
253 //////////////////////////////////////////////////////////////////////////////
254 //////////////////////////////////////////////////////////////////////////////
255 //////////////////////////////////////////////////////////////////////////////
257 //////////////////////////////////////////////////////////////////////////////
259 .Function.arrayConstruct:
261 ..summary:Construct objects in a given memory buffer.
262 ..signature:arrayConstruct(begin, end [, value])
263 ..param.begin:Iterator to the begin of the range that is to be constructed.
264 ..param.end:Iterator behind the end of the range.
265 ..param.value:Argument that is forwarded to the constructor. (optional)
266 ...text:An appropriate constructor is required.
267 If $value$ is not specified, the default constructor is used.
268 ..remarks:The type of the constructed Objects is the @Metafunction.Value.value type@
269 of $begin$ and $end$.
270 ..see:Function.arrayDestruct
271 ..see:Function.arrayConstructCopy
272 ..see:Function.arrayFill
273 ..see:Class.SimpleType
274 ..see:Function.valueConstruct
276 template<typename TIterator1, typename TIterator2>
278 _arrayConstruct_Default(TIterator1 begin_,
282 while (begin_ != end_)
284 valueConstruct(begin_);
288 template<typename TIterator1, typename TIterator2>
290 arrayConstruct(TIterator1 begin_,
294 _arrayConstruct_Default(begin_, end_);
297 //____________________________________________________________________________
299 template<typename TIterator1, typename TIterator2, typename TParam>
301 _arrayConstruct_Default(TIterator1 begin_,
303 TParam const & param_)
306 while (begin_ != end_)
308 valueConstruct(begin_, param_);
312 template<typename TIterator1, typename TIterator2, typename TParam>
314 arrayConstruct(TIterator1 begin_,
316 TParam const & param_)
319 _arrayConstruct_Default(begin_, end_, param_);
322 //////////////////////////////////////////////////////////////////////////////
324 //////////////////////////////////////////////////////////////////////////////
327 .Function.arrayConstructCopy:
329 ..summary:Copy constructs an array of objects into in a given memory buffer.
330 ..signature:arrayConstructCopy(source_begin, source_end, target)
331 ..param.source_begin:Iterator to the first element of the source range.
332 ..param.source_end:Iterator behind the last element of the source range.
333 ...text:$source_end$ should have the same type as $source_begin$.
334 ..param.target:Pointer to the memory block the new objects will be constructed in.
335 ...text:The type of $target$ specifies the type of the constructed objects:
336 If $T*$ is the type of $target$, then the function constructs objects of type $T$.
337 ...text:The memory buffer should be large enough to store $source_end$ - $source_begin$ objects.
338 An appropriate (copy-) constructor that constructs an target objects given a source object is required.
339 ..see:Function.arrayDestruct
340 ..see:Function.arrayCopyForward
341 ..see:Function.arrayCopy
342 ..see:Function.valueConstruct
344 template<typename TTarget, typename TSource1, typename TSource2>
346 _arrayConstructCopy_Default(TSource1 source_begin,
348 TTarget target_begin)
351 while (source_begin != source_end)
353 valueConstruct(target_begin, *source_begin);
359 template<typename TTarget, typename TSource1, typename TSource2>
361 arrayConstructCopy(TSource1 source_begin,
363 TTarget target_begin)
366 _arrayConstructCopy_Default(source_begin, source_end, target_begin);
369 //////////////////////////////////////////////////////////////////////////////
371 //////////////////////////////////////////////////////////////////////////////
374 .Function.arrayConstructMove:
376 ..summary:Move constructs an array of objects into in a given memory buffer.
377 ..signature:arrayConstructMove(source_begin, source_end, target)
378 ..param.source_begin:Iterator to the first element of the source range.
379 ..param.source_end:Iterator behind the last element of the source range.
380 ...text:$source_end$ should have the same type as $source_begin$.
381 ..param.target:Pointer to the memory block the new objects will be constructed in.
382 ...text:The type of $target$ specifies the type of the constructed objects:
383 If $T*$ is the type of $target$, then the function constructs objects of type $T$.
384 ...text:The memory buffer should be large enough to store $source_end$ - $source_begin$ objects.
385 An appropriate move constructor that constructs an target objects given a source object is required.
386 ..see:Function.arrayDestruct
387 ..see:Function.arrayConstructCopy
388 ..see:Function.arrayMoveForward
389 ..see:Function.arrayMove
390 ..see:Function.valueConstruct
392 template<typename TTarget, typename TSource1, typename TSource2>
394 _arrayConstructMove_Default(TSource1 source_begin,
396 TTarget target_begin)
399 while (source_begin < source_end)
401 valueConstructMove(target_begin, *source_begin);
407 template<typename TTarget, typename TSource1, typename TSource2>
409 arrayConstructMove(TSource1 source_begin,
411 TTarget target_begin)
414 _arrayMoveConstruct_Default(source_begin, source_end, target_begin);
417 //////////////////////////////////////////////////////////////////////////////
419 //////////////////////////////////////////////////////////////////////////////
422 .Function.arrayDestruct:
424 ..summary:Destroys an array of objects.
425 ..signature:arrayDestruct(begin, end)
426 ..param.begin:Iterator to the begin of the range that is to be destructed.
427 ..param.end:Iterator behind the end of the range.
428 ..remarks:This function does not deallocates the memory.
429 ..see:Class.SimpleType
430 ..see:Function.valueDestruct
432 template<typename TIterator1, typename TIterator2>
434 _arrayDestruct_Default(TIterator1 begin_,
438 while (begin_ != end_)
440 valueDestruct(begin_);
444 template<typename TIterator1, typename TIterator2>
446 arrayDestruct(TIterator1 begin_,
450 _arrayDestruct_Default(begin_, end_);
453 //////////////////////////////////////////////////////////////////////////////
455 //////////////////////////////////////////////////////////////////////////////
460 ..summary:Assigns one object to each element of a range.
461 ..signature:arrayFill(begin, end, value)
462 ..param.begin:Iterator to the begin of the range that is to be filled.
463 ..param.end:Iterator behind the end of the range.
464 ..param.value:Argument that is assigned to all $count$ objects in $array$.
465 ..remarks:All objects $target_begin[0]$ to $target_begin[count-1]$ are set to $value$.
466 ..see:Function.arrayCopy
467 ..see:Function.arrayCopyForward
469 template<typename TIterator1, typename TIterator2, typename TValue>
471 arrayFill(TIterator1 begin_,
473 TValue const & value)
476 ::std::fill_n(begin_, end_ - begin_, value);
479 //////////////////////////////////////////////////////////////////////////////
481 //////////////////////////////////////////////////////////////////////////////
484 .Function.arrayCopyForward:
486 ..summary:Copies a range of objects into another range of objects starting from the first element.
487 ..signature:arrayCopyForward(source_begin, source_end, target)
488 ..param.source_begin:Iterator to the first element of the source array.
489 ..param.source_end:Iterator behind the last element of the source array.
490 ...text:$source_end$ must have the same type as $source_begin$.
491 ..param.target:Iterator to the first element of the target array.
492 ...text:The target capacity should be at least as long as the source range.
493 ..remarks.note:Be careful if source and target range overlap, because in this case
494 some source elements could be accidently overwritten before they are moved.
495 ..remarks:If there is no need for the source elements to persist, consider to use
496 @Function.arrayMoveForward@ instead to improve performance.
497 ..see:Class.SimpleType
499 template<typename TTarget, typename TSource1, typename TSource2>
501 _arrayCopyForward_Default(TSource1 source_begin,
503 TTarget target_begin)
506 ::std::copy(source_begin, source_end, target_begin);
508 template<typename TTarget, typename TSource1, typename TSource2>
510 arrayCopyForward(TSource1 source_begin,
512 TTarget target_begin)
515 _arrayCopyForward_Default(source_begin, source_end, target_begin);
518 //////////////////////////////////////////////////////////////////////////////
520 //////////////////////////////////////////////////////////////////////////////
523 .Function.arrayCopyBackward:
525 ..summary:Copies a range of objects into another range of objects starting from the last element.
526 ..signature:arrayCopyBackward(source_begin, source_end, target)
527 ..param.source_begin:Iterator to the first element of the source array.
528 ..param.source_end:Iterator behind the last element of the source array.
529 ...text:$source_end$ must have the same type as $source_begin$.
530 ..param.target:Iterator to the first element of the target array.
531 ...text:The target capacity should be at least as long as the source range.
532 ..remarks.note:Be careful if source and target range overlap, because in this case
533 some source elements could be accidently overwritten before they are moved.
534 ..remarks.text:If source and target do not overlap, consider to use the function
535 @Function.arrayCopyForward@ instead that is faster in some cases.
536 ..remarks:If there is no need for the source elements to persist, consider to use
537 @Function.arrayMoveBackward@ instead to improve performance.
538 ..remarks.note:The semantic of this function's argument $target$ differ from the arguments of $::std::copy_backward$.
539 ..see:Function.arrayCopyForward
540 ..see:Class.SimpleType
542 template<typename TTarget, typename TSource1, typename TSource2>
544 _arrayCopyBackward_Default(TSource1 source_begin,
546 TTarget target_begin)
549 ::std::copy_backward(source_begin, source_end, target_begin + (source_end - source_begin));
551 template<typename TTarget, typename TSource1, typename TSource2>
553 arrayCopyBackward(TSource1 source_begin,
555 TTarget target_begin)
558 _arrayCopyBackward_Default(source_begin, source_end, target_begin);
562 //////////////////////////////////////////////////////////////////////////////
564 //////////////////////////////////////////////////////////////////////////////
569 ..summary:Copies a range of objects into another range of objects.
570 ..signature:arrayCopy(source_begin, source_end, target)
571 ..param.source_begin:Iterator to the first element of the source range.
572 ..param.source_end:Iterator behind the last element of the source range.
573 ...text:$source_end$ must have the same type as $source_begin$.
574 ..param.target:Iterator to the first element of the target range.
575 ...text:The target capacity should be at least as long as the source range.
576 ..remarks.text:If source and target range do not overlap, consider to use
577 @Function.arrayCopyForward@ instead to improve performance.
578 ..remarks:If there is no need for the source elements to persist, consider to use
579 @Function.arrayMoveForward@ instead to improve performance.
580 ..DISABLED.remarks.note:Be careful if source and target range overlap and the size of the
581 source elements differ from the size of target elements, because in this case
582 some source elements could be accidently overwritten before they are moved.
583 ..see:Function.arrayCopyForward
584 ..see:Function.arrayCopyBackward
585 ..see:Class.SimpleType
587 template<typename TTarget, typename TSource1, typename TSource2>
588 inline void arrayCopy(TSource1 source_begin,
590 TTarget target_begin)
592 if ((void *) source_begin >= (void *) target_begin)
595 arrayCopyForward(source_begin, source_end, target_begin);
600 arrayCopyBackward(source_begin, source_end, target_begin);
604 //////////////////////////////////////////////////////////////////////////////
606 //////////////////////////////////////////////////////////////////////////////
609 .Function.arrayMoveForward:
611 ..summary:Moves a range of objects into another range of objects starting from the first element.
612 ..signature:arrayMoveForward(source_begin, source_end, target)
613 ..param.source_begin:Iterator to the first element of the source array.
614 ..param.source_end:Iterator behind the last element of the source array.
615 ...text:$source_end$ must have the same type as $source_begin$.
616 ..param.target:Iterator to the first element of the target array.
617 ...text:The target capacity should be at least as long as the source range.
618 ..remarks:The function possibly clears (but does not destroy) the source elements.
619 If source elements must persist, consider to use @Function.arrayCopyForward@ instead.
620 ..remarks.note:Be careful if source and target range overlap, because in this case
621 some source elements could be accidently overwritten before they are moved.
622 ..see:Function.arrayCopyForward
623 ..see:Class.SimpleType
625 template<typename TTarget, typename TSource1, typename TSource2>
627 _arrayMoveForward_Default(TSource1 source_begin,
629 TTarget target_begin)
632 while (source_begin != source_end)
634 move(*target_begin, *source_begin);
639 template<typename TTarget, typename TSource1, typename TSource2>
641 arrayMoveForward(TSource1 source_begin,
643 TTarget target_begin)
646 _arrayMoveForward_Default(source_begin, source_end, target_begin);
649 //////////////////////////////////////////////////////////////////////////////
651 //////////////////////////////////////////////////////////////////////////////
654 .Function.arrayMoveBackward:
656 ..summary:Moves a range of objects into another range of objects starting from the last element.
657 ..signature:arrayMoveBackward(source_begin, source_end, target)
658 ..param.source_begin:Iterator to the first element of the source array.
659 ..param.source_end:Iterator behind the last element of the source array.
660 ...text:$source_end$ must have the same type as $source_begin$.
661 ..param.target:Iterator to the first element of the target array.
662 ...text:The target capacity should be at least as long as the source range.
663 ..remarks:The function possibly clears (but does not destroy) the source elements.
664 If source elements must persist, consider to use @Function.arrayCopyBackward@ instead.
665 ..remarks.note:Be careful if source and target range overlap, because in this case
666 some source elements could be accidently overwritten before they are moved.
667 ..remarks.text:If source and target do not overlap, consider to use the function
668 @Function.arrayMoveForward@ instead that is faster in some cases.
669 ..remarks.note:The semantic of this function's argument $target$ differ from the arguments of $::std::copy_backward$.
670 ..see:Function.arrayMoveForward
671 ..see:Function.arrayCopyBackward
672 ..see:Class.SimpleType
674 template<typename TTarget, typename TSource1, typename TSource2>
676 _arrayMoveBackward_Default(TSource1 source_begin,
678 TTarget target_begin)
681 target_begin += (source_end - source_begin);
682 while (source_end != source_begin)
686 move(*target_begin, *source_end);
689 template<typename TTarget, typename TSource1, typename TSource2>
691 arrayMoveBackward(TSource1 source_begin,
693 TTarget target_begin)
696 _arrayMoveBackward_Default(source_begin, source_end, target_begin);
699 //////////////////////////////////////////////////////////////////////////////
701 //////////////////////////////////////////////////////////////////////////////
706 ..summary:Moves a range of objects into another range of objects.
707 ..signature:arrayMove(source_begin, source_end, target)
708 ..param.source_begin:Iterator to the first element of the source range.
709 ..param.source_end:Iterator behind the last element of the source range.
710 ...text:$source_end$ must have the same type as $source_begin$.
711 ..param.target:Iterator to the first element of the target range.
712 ...text:The target capacity should be at least as long as the source range.
713 ..remarks:The function possibly clears (but does not destroy) the source elements.
714 If source elements must persist, consider to use @Function.arrayCopy@ instead.
715 ..remarks.text:If source and target range do not overlap, consider to use
716 @Function.arrayMoveForward@ instead to improve performance.
717 ..DISABLED.remarks.note:Be careful if source and target range overlap and the size of the
718 source elements differ from the size of target elements, because in this case
719 some source elements could be accidently overwritten before they are moved.
720 ..remarks.note:Don't confuse this function with the standard $move$ function that
721 resembles @Function.arrayCopy@.
722 ..see:Function.arrayMoveForward
723 ..see:Function.arrayMoveBackward
724 ..see:Function.arrayCopy
725 ..see:Class.SimpleType
727 template<typename TTarget, typename TSource1, typename TSource2>
729 arrayMove(TSource1 source_begin,
731 TTarget target_begin)
733 if ((void *) source_begin >= (void *) target_begin)
736 arrayMoveForward(source_begin, source_end, target_begin);
741 arrayMoveBackward(source_begin, source_end, target_begin);
745 //////////////////////////////////////////////////////////////////////////////
747 //////////////////////////////////////////////////////////////////////////////
750 .Function.arrayClearSpace:
752 ..summary:Destroys the begin of an array and keeps the rest.
753 ..signature:arrayClearSpace(arr_begin, arr_length, keep_from, move_to)
754 ..param.arr_begin:Pointer to the first element of the array.
755 ..param.arr_length:Length of the array.
756 ..param.keep_from:Offset of the first object that will be kept.
757 ..param.move_to:Offset the first kept object will get at the end of the function.
758 ..remarks.text:The objects $arr[keep_from]$ to $arr[arr_length-1]$
759 are moved to the area beginning at positions $move_to$.
760 All objects in $arr[0]$ to $arr[keep_from-1]$ are destroyed.
761 After this function, the first $move_to$ positions of the array
762 are free and dont contain objects.
763 ..remarks.text:The array must have at least enough space to store $arr_length + move_to - keep_from$ objects.
764 ..see:Function.arrayCopy
765 ..see:Function.arrayDestruct
766 ..see:Function.arrayCopyForward
767 ..see:Class.SimpleType
769 template <typename TIterator>
770 void _arrayClearSpace_Default(TIterator array_begin,
775 if (keep_from == array_length)
777 arrayDestruct(array_begin, array_begin + array_length);
781 SEQAN_ASSERT(keep_from < array_length)
783 if (keep_from == move_to)
785 arrayDestruct(array_begin, array_begin + move_to);
787 else if (keep_from < move_to)
789 if (array_length > move_to)
792 size_t middle = array_length - (move_to - keep_from);
793 arrayConstructMove(array_begin + middle, array_begin + array_length, array_begin + array_length);
794 arrayMove(array_begin + keep_from, array_begin + middle, array_begin + move_to);
795 arrayDestruct(array_begin, array_begin + move_to);
800 arrayConstructMove(array_begin + keep_from, array_begin + array_length, array_begin + move_to);
801 arrayDestruct(array_begin, array_begin + array_length);
807 arrayMove(array_begin + keep_from, array_begin + array_length, array_begin + move_to);
808 arrayDestruct(array_begin, array_begin + move_to);
809 arrayDestruct(array_begin + array_length - (keep_from - move_to), array_begin + array_length);
813 template <typename TIterator>
814 void arrayClearSpace(TIterator array_begin,
819 _arrayClearSpace_Default(array_begin, array_length, keep_from, move_to);
823 //////////////////////////////////////////////////////////////////////////////
825 //////////////////////////////////////////////////////////////////////////////
827 .Metafunction.BitsPerValue:
828 ..summary:Number of bits needed to store a value.
829 ..signature:BitsPerValue<T>::VALUE
831 ..returns.param.VALUE:Number of bits needed to store $T$.
832 ...default:$sizeof<T> * 8$
833 ..see:Metafunction.ValueSize
835 template <typename TValue>
838 enum { VALUE = sizeof(TValue) * 8 };
840 template <typename TValue>
841 struct BitsPerValue<TValue const>:
842 public BitsPerValue<TValue> {};
844 //////////////////////////////////////////////////////////////////////////////
846 //////////////////////////////////////////////////////////////////////////////
848 .Metafunction.ValueSize:
849 ..summary:Number of different values a value type object can have.
850 ..signature:ValueSize<T>::VALUE
852 ..returns.param.VALUE:Value size of $T$.
854 ...text:This function is only defined for integral types like $unsigned int$, $double$ or @Spec.Dna@.
855 ..see:Metafunction.Value
857 template <typename T>
860 enum { VALUE = 1 << BitsPerValue<T>::VALUE };
862 template <typename TValue>
863 struct ValueSize<TValue const>:
864 public ValueSize<TValue> {};
868 template < typename T >
869 struct _SupremumValueUnsigned { static const T VALUE; };
870 template < typename T >
871 struct _SupremumValueSigned { static const T VALUE; };
873 template < typename T >
874 struct _InfimumValueUnsigned { static const T VALUE; };
875 template < typename T >
876 struct _InfimumValueSigned { static const T VALUE; };
880 template < typename T >
881 const T _SupremumValueUnsigned<T>::VALUE = ~(T)0;
882 template < typename T >
883 const T _SupremumValueSigned<T>::VALUE = ( (((T)1 << (BitsPerValue<T>::VALUE - 2)) - 1) << 1) + 1;
885 template < typename T >
886 const T _InfimumValueUnsigned<T>::VALUE = 0;
887 template < typename T >
888 const T _InfimumValueSigned<T>::VALUE = ~(T)_SupremumValueSigned<T>::VALUE;
894 typename TParent = typename IF<
895 TYPECMP< typename _MakeSigned<T>::Type, T >::VALUE,
896 _SupremumValueSigned<T>,
897 _SupremumValueUnsigned<T> >::Type >
898 struct SupremumValue:
905 typename TParent = typename IF<
906 TYPECMP< typename _MakeSigned<T>::Type, T >::VALUE,
907 _InfimumValueSigned<T>,
908 _InfimumValueUnsigned<T> >::Type >
914 //////////////////////////////////////////////////////////////////////////////
915 }// namespace SEQAN_NAMESPACE_MAIN
917 #endif //#ifndef SEQAN_HEADER_...