xref: /haiku/headers/os/package/solver/SolverProblem.h (revision 9f81ca838ce7b92b5689e57d3f86765db4705a7b)
11a4d020dSIngo Weinhold /*
21a4d020dSIngo Weinhold  * Copyright 2013, Haiku, Inc. All Rights Reserved.
31a4d020dSIngo Weinhold  * Distributed under the terms of the MIT License.
41a4d020dSIngo Weinhold  */
51a4d020dSIngo Weinhold #ifndef _PACKAGE__SOLVER_PROBLEM_H_
61a4d020dSIngo Weinhold #define _PACKAGE__SOLVER_PROBLEM_H_
71a4d020dSIngo Weinhold 
81a4d020dSIngo Weinhold 
9*5e01af31SIngo Weinhold #include <ObjectList.h>
101a4d020dSIngo Weinhold #include <package/PackageResolvableExpression.h>
111a4d020dSIngo Weinhold 
121a4d020dSIngo Weinhold 
131a4d020dSIngo Weinhold namespace BPackageKit {
141a4d020dSIngo Weinhold 
151a4d020dSIngo Weinhold 
161a4d020dSIngo Weinhold class BSolverPackage;
17*5e01af31SIngo Weinhold class BSolverProblemSolution;
181a4d020dSIngo Weinhold 
191a4d020dSIngo Weinhold 
201a4d020dSIngo Weinhold class BSolverProblem {
211a4d020dSIngo Weinhold public:
221a4d020dSIngo Weinhold 			enum BType {
231a4d020dSIngo Weinhold 				B_UNSPECIFIED,
241a4d020dSIngo Weinhold 				B_NOT_IN_DISTUPGRADE_REPOSITORY,
251a4d020dSIngo Weinhold 				B_INFERIOR_ARCHITECTURE,
261a4d020dSIngo Weinhold 				B_INSTALLED_PACKAGE_PROBLEM,
271a4d020dSIngo Weinhold 				B_CONFLICTING_REQUESTS,
281a4d020dSIngo Weinhold 				B_REQUESTED_RESOLVABLE_NOT_PROVIDED,
291a4d020dSIngo Weinhold 				B_REQUESTED_RESOLVABLE_PROVIDED_BY_SYSTEM,
301a4d020dSIngo Weinhold 				B_DEPENDENCY_PROBLEM,
311a4d020dSIngo Weinhold 				B_PACKAGE_NOT_INSTALLABLE,
321a4d020dSIngo Weinhold 				B_DEPENDENCY_NOT_PROVIDED,
331a4d020dSIngo Weinhold 				B_PACKAGE_NAME_CLASH,
341a4d020dSIngo Weinhold 				B_PACKAGE_CONFLICT,
351a4d020dSIngo Weinhold 				B_PACKAGE_OBSOLETES_RESOLVABLE,
361a4d020dSIngo Weinhold 				B_INSTALLED_PACKAGE_OBSOLETES_RESOLVABLE,
371a4d020dSIngo Weinhold 				B_PACKAGE_IMPLICITLY_OBSOLETES_RESOLVABLE,
381a4d020dSIngo Weinhold 				B_DEPENDENCY_NOT_INSTALLABLE,
391a4d020dSIngo Weinhold 				B_SELF_CONFLICT
401a4d020dSIngo Weinhold 			};
411a4d020dSIngo Weinhold 
421a4d020dSIngo Weinhold public:
431a4d020dSIngo Weinhold 								BSolverProblem(BType type,
441a4d020dSIngo Weinhold 									BSolverPackage* sourcePackage,
451a4d020dSIngo Weinhold 									BSolverPackage* targetPackage = NULL);
461a4d020dSIngo Weinhold 								BSolverProblem(BType type,
471a4d020dSIngo Weinhold 									BSolverPackage* sourcePackage,
481a4d020dSIngo Weinhold 									BSolverPackage* targetPackage,
491a4d020dSIngo Weinhold 									const BPackageResolvableExpression&
501a4d020dSIngo Weinhold 										dependency);
511a4d020dSIngo Weinhold 								~BSolverProblem();
521a4d020dSIngo Weinhold 
531a4d020dSIngo Weinhold 			BType				Type() const;
541a4d020dSIngo Weinhold 			BSolverPackage*		SourcePackage() const;
551a4d020dSIngo Weinhold 			BSolverPackage*		TargetPackage() const;
561a4d020dSIngo Weinhold 			const BPackageResolvableExpression& Dependency() const;
571a4d020dSIngo Weinhold 
58*5e01af31SIngo Weinhold 			int32				CountSolutions() const;
59*5e01af31SIngo Weinhold 			const BSolverProblemSolution* SolutionAt(int32 index) const;
60*5e01af31SIngo Weinhold 
61*5e01af31SIngo Weinhold 			bool				AppendSolution(
62*5e01af31SIngo Weinhold 									BSolverProblemSolution* solution);
63*5e01af31SIngo Weinhold 
641a4d020dSIngo Weinhold 			BString				ToString() const;
651a4d020dSIngo Weinhold 
661a4d020dSIngo Weinhold private:
67*5e01af31SIngo Weinhold 			typedef BObjectList<BSolverProblemSolution> SolutionList;
68*5e01af31SIngo Weinhold 
69*5e01af31SIngo Weinhold private:
701a4d020dSIngo Weinhold 			BType				fType;
711a4d020dSIngo Weinhold 			BSolverPackage*		fSourcePackage;
721a4d020dSIngo Weinhold 			BSolverPackage*		fTargetPackage;
731a4d020dSIngo Weinhold 			BPackageResolvableExpression fDependency;
74*5e01af31SIngo Weinhold 			SolutionList		fSolutions;
751a4d020dSIngo Weinhold };
761a4d020dSIngo Weinhold 
771a4d020dSIngo Weinhold 
781a4d020dSIngo Weinhold }	// namespace BPackageKit
791a4d020dSIngo Weinhold 
801a4d020dSIngo Weinhold 
811a4d020dSIngo Weinhold #endif // _PACKAGE__SOLVER_PROBLEM_H_
82