Commit 4ccd66da authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

Predicates: PredicateAwesome does ORs but needs more work

parent 5503e82b
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
#include "Vector.h"
#include "PredicateAnd.h"

namespace Dmrg {
namespace PsimagLite {

/* PSIDOC PredicateAwesome
 Comma-separated list of items, don't leave spaces:
@@ -67,10 +67,21 @@ class PredicateAwesome {

public:

	typedef PsimagLite::Vector<PredicateAnd>::Type VectorPredicateAndType;
	typedef Vector<PredicateAnd>::Type VectorPredicateAndType;
	typedef PredicateAnd::VectorStringType VectorStringType;

	PredicateAwesome(String pred)
	    : pred_(pred)
	{
		VectorStringType tokens;
		split(tokens, pred, ",");
		const SizeType n = tokens.size();
		for (SizeType i = 0; i < n; ++i)
			predicateAnd_.push_back(PredicateAnd(tokens[i]));
	}

	template<typename T>
    bool isTrue(PsimagLite::String name, T val)
	bool isTrue(String name, T val)
	{
		SizeType n = predicateAnd_.size();
		for (SizeType i = 0; i < n; ++i)
@@ -80,8 +91,8 @@ public:

private:

	String pred_;
	VectorPredicateAndType predicateAnd_;

};
}
#endif // PREDICATE_AWESOME_H